├── .gitattributes
├── .gitignore
├── README.md
├── build.sh
├── changeVersion.sh
├── com.restphone.androidproguardscala.feature
├── .project
├── .settings
│ └── org.eclipse.m2e.core.prefs
├── README
├── build.properties
├── feature.xml
└── pom.xml
├── com.restphone.androidproguardscala.parent
├── .gitignore
├── cmds
└── pom.xml
├── com.restphone.androidproguardscala.plugin
├── .classpath
├── .externalToolBuilders
│ └── org.eclipse.pde.api.tools.apiAnalysisBuilder.launch
├── .project
├── .settings
│ ├── org.eclipse.jdt.core.prefs
│ └── org.eclipse.m2e.core.prefs
├── COPYING
├── META-INF
│ └── MANIFEST.MF
├── README.windows
├── build.properties
├── docs
│ ├── GPL.html
│ └── GPL_exception.html
├── ecosystem-build.sh
├── lib
│ └── scala-library_2.11-1.0.0.jar
├── plugin.xml
├── pom.xml
├── proguard_cache
│ └── .keep
├── proguard_cache_conf
│ ├── proguard_additions.conf
│ └── proguard_defaults.conf
└── src
│ ├── main
│ ├── java
│ │ ├── .keepdir
│ │ └── com
│ │ │ ├── bdaum
│ │ │ └── overlayPages
│ │ │ │ ├── FieldEditorOverlayPage.java
│ │ │ │ ├── Messages.java
│ │ │ │ ├── Messages.properties
│ │ │ │ ├── OverlayPage.java
│ │ │ │ └── PropertyStore.java
│ │ │ └── restphone
│ │ │ └── androidproguardscala
│ │ │ └── preferences
│ │ │ ├── PreferenceConstants.java
│ │ │ └── PreferenceInitializer.java
│ ├── resources
│ │ └── .keep
│ └── scala
│ │ └── com
│ │ └── restphone
│ │ └── androidproguardscala
│ │ ├── Activator.scala
│ │ ├── AndroidProguardScalaBuilder.scala
│ │ ├── ApsNature.scala
│ │ ├── ClasspathEntryData.scala
│ │ ├── JavaProjectData.scala
│ │ ├── ProjectUtilities.scala
│ │ ├── ProvidesLogging.scala
│ │ ├── ToggleNature.scala
│ │ ├── Utilities.scala
│ │ └── preferences
│ │ ├── ClasspathPreferences.scala
│ │ └── PreferenceConstants.scala
│ └── test
│ └── resources
│ └── .keep
├── com.restphone.androidproguardscala.updatesite
├── .gitignore
├── category.xml
└── pom.xml
├── deploy.sh
├── install.sh
├── pom.xml
└── sbtbuild
├── .gitignore
├── AndroidProguardScalaLib
├── Jartender
├── JavaSignatureParser
├── ScalaTestUtilities
├── build.sbt
└── project
└── Build.scala
/.gitattributes:
--------------------------------------------------------------------------------
1 | # These files are text and should be normalized (convert crlf => lf)
2 | *.cs text diff=csharp
3 | *.xaml text
4 | *.csproj text
5 | *.sln text
6 | *.tt text
7 | *.ps1 text
8 | *.cmd text
9 | *.msbuild text
10 | *.md text
11 |
12 | * .html text
13 | * .java text
14 | * .sbt text
15 | * .scala text
16 | * .sh text
17 | * .txt text
18 | * .xml text
19 | * .pom text
20 |
21 | # Images should be treated as binary
22 | # (binary is a macro for -text -diff)
23 | *.png binary
24 | *.jepg binary
25 |
26 | *.sdf binary
27 | *.jar binary
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | lib
3 | .DS_Store
4 | .cache
5 | plugins/*.jar
6 | project/
7 | target/
8 | jarjar/*
9 | output
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OBSOLETE
2 |
3 | This is an Eclipse plugin for the obsolete Android Eclipse development system, and isn't relevant for modern Scala on Android.
4 |
5 | # OVERVIEW
6 |
7 | AndroidProguardScala is an Eclipse plugin that speeds up the development process when you're using Scala on Android.
8 |
9 | Scala + Android requires a Proguard run on every build. That's slow. The plugin watches code changes
10 | and avoids running Proguard if no significant changes have happened.
11 |
12 | The plugin is intended for development-time only. You should continue to use Proguard with your own configuration
13 | for release builds.
14 |
15 | NOTE: Your project must have Scala nature or the plugin will fail to run.
16 |
17 | # Upgrading to Scala 2.11
18 |
19 | Make sure you install version 51 or later of this plugin.
20 |
21 | Check the project properties for "AndroidProguardScala Properties" - make sure the new Scala libraries are checked if you're using them.
22 |
23 | # USING THE PLUGIN
24 |
25 | 1. Install the Scala IDE from http://scala-ide.org/download/current.html.
26 |
27 | 1. Point Eclipse to the update site at https://androidproguardscala.s3.amazonaws.com/UpdateSiteForAndroidProguardScala and install.
28 | Note that this isn't a link you can visit in a browser.
29 | Eclipse knows about the layout of files underneath that link, but you'll just get a 404 for the top level.
30 |
31 | 2. Open an existing Android project, or create a new one.
32 |
33 | 2. Add Scala nature to the project by right-clicking the project name.
34 |
35 | 2. Right-click on your Android project and choose "Add AndroidProguardScala Nature."
36 |
37 | 3. Open the properties for your project (right-click on the project name in the navigator, select properties from the menu)
38 | and choose "AndroidProguardScala Properties". Choose which jars in the classpath will be included in the minified jar. By
39 | default, the standard scala libraries will be included.
40 |
41 | 4. After a build, notice that the directories 'proguard_cache' and 'proguard_cache_conf' are created.
42 |
43 | proguard_cache contains the cached libraries and the files used to figure out which cached library to use (including whether or
44 | not a new library needs to be generated.
45 |
46 | proguard_cache_conf contains the generated proguard configuration files. You should be able to use
47 | proguard_postprocessed.conf as a config file outside of this tool.
48 |
49 | # Managed dependencies
50 |
51 | As long as your dependency resolution tool puts libraries on the classpath, this plugin can use them.
52 |
53 | ## Ivy
54 |
55 | I use [IvyDE](http://ant.apache.org/ivy/ivyde/) to manage dependencies in Eclipse.
56 | IvyDE puts dependencies in its own classpath container, so you can just mark them as input jars
57 | and they'll end up in scala-library.min.jar. Nothing to configure other than marking the jars correctly in the plugin preferences.
58 | See the sbt section for how to turn sbt dependencies into something that IvyDE can use.
59 |
60 | ## sbt
61 |
62 | sbt will generate ivy dependency files that can be read by IvyDE. Just run deliver-local in sbt and it'll build an ivy xml file in
63 | something like target/scala-2.10/ivy-0.4-SNAPSHOT.xml. Point IvyDE to that file and you'll end up with dependencies on your
64 | classpath that can be used by the plugin.
65 |
66 | I don't actually use that ivy file though, since sbt can delete it. I copy target/scala-2.10/ivy-0.4-SNAPSHOT.xml into the
67 | project root and name it ivy.xml. It's an extra step (that can probably be automated inside sbt, but I've never bothered to learn
68 | how) but it avoids problems with the sbt build removing target/scala-2.10/ivy-0.4-SNAPSHOT.xml.
69 |
70 | ## Maven
71 |
72 | TBD. The problem with m2eclipse is that it takes over lots of the build process, so I never got it working nicely with
73 | AndroidProguardScala.
74 |
75 | # Troubleshooting
76 |
77 | * If you get a scala-library.min.jar, but it's empty, make sure you have a resonable set of libraries configured in the
78 | plugin properties. Right click on your project and select AndroidProguardScala properties. ("Reasonable" depends on what you're
79 | trying do do - just keep in mind that the plugin properties end up as settings in proguard_processed.conf.)
80 |
81 | * Look at the proguard_processed.conf file. Does it make sense? There should be -libraryjar lines for the standard Scala
82 | libraries that your project uses, and -keep lines for all of your own code.
83 |
84 | * Can you run proguard from a command line using the proguard_processed.conf file? That file is a normal proguard configuration
85 | and should work outside the plugin - there's nothing special or exotic about it.
86 |
87 | On Linux and OSX, you should be able to run by doing something like this:
88 |
89 | ```
90 | cd /My/project/directory
91 | java -jar /Users/james/android-sdk-mac_86/tools.adt20/proguard/lib/proguard.jar @proguard_cache/proguard_processed.conf
92 | ```
93 |
94 | # Reporting bugs
95 |
96 | If you've got a failing project, the very best thing for me is a tarball of the entire project,
97 | including all the built binaries. Yes, this is big, but most android projects will be less than a gigabyte.
98 |
99 | The second-best thing is all of the source files minus the binaries. Definitely include all the files I need to
100 | bring this up as an Eclipse project.
101 |
102 | The third-best is something like an sbt project where I can run 'sbt eclipse'. The problem with this is that
103 | sbt-eclipse doesn't always produce a working project, so I'm less likely to be able to take the time to get it working.
104 |
105 | If you can't do that, a copy of the generated proguard config file is helpful, along with any errors you see in the
106 | Eclipse error log.
107 |
108 | # Release Notes
109 |
110 | ## v51
111 |
112 | Support for Scala 2.11
113 |
114 | ## v50
115 |
116 | * Update to latest version of dependencies (Scala 2.10.2, Scalaz 7.0.2)
117 | * Better checking for Proguard errors
118 |
119 | ## v49
120 |
121 | Experimental attempt to join the Scala ecosystem
122 |
123 | ## v48 (never released)
124 |
125 | * Fixed license files and xml
126 | * Build improvements for working in the Scala ecosystem
127 |
128 | ## v47 (current release)
129 |
130 | * An Eclipse clean build now cleans the AndroidProguardScala cache
131 | * Added the plugin version number to the generated Proguard config file (should make tracking down bugs easier)
132 | * Write the name of the cached library to the Eclipse log on a build, don't just report a cache hit or miss
133 |
134 | ## v46
135 |
136 | * Changed Proguard defaults to include fix for https://issues.scala-lang.org/browse/SI-5397
137 | * Updated to Scala release 2.10
138 | * Default to ignore scala-swing.jar
139 | * Internal build improvements
140 |
141 | ## v45
142 |
143 | * Improved build process to avoid issues with categorization
144 |
145 | ## v44
146 |
147 | * Fixed https://github.com/banshee/AndroidProguardScala/issues/22. Defaults are now set correctly. Before, defaults weren't set
148 | until you visited the project settings page.
149 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | buildDir=/tmp/apsbuilds
4 |
5 | mkdir -p $buildDir
6 |
7 | ~/src/s3cmd/s3cmd del --recursive s3://androidproguardscala/UpdateSiteForAndroidProguardScalaEcosystem/
8 |
9 | baseUrl=http://download.scala-ide.org/ecosystem
10 | for eclipse in e37 e38; do
11 | for scala in scala210; do
12 | # for scala in scala29 scala210; do
13 | for releaseType in dev stable; do
14 | dirname=${releaseType}-${scala}-${eclipse}
15 | destination=$buildDir/$dirname
16 | mkdir -p $destination
17 | rsync --delete --delete-excluded --exclude target -a * $destination
18 | finalUrl=$baseUrl/$eclipse/${nextOrCurrent}$scala/$releaseType/site
19 | if [ "$eclipse" = "e37" ] ; then
20 | eclipseUrl=http://download.eclipse.org/releases/indigo/
21 | else
22 | eclipseUrl=http://download.eclipse.org/releases/juno/
23 | fi
24 | eclipseUrlArg="-Drepo.eclipse=$eclipseUrl"
25 | scalaIdeUrl="-Drepo.scala-ide=$finalUrl"
26 | ( cd $destination ; mvn -Pset-versions $scalaIdeUrl $eclipseUrlArg -Dtycho.style=maven --non-recursive exec:java ; echo "cd com.restphone.androidproguardscala.parent ; mvn $scalaIdeUrl $eclipseUrlArg install" > compile.sh ; sh compile.sh )
27 | echo set up in $destination $scalaIdeUrl $eclipseUrlArg
28 | ~/src/s3cmd/s3cmd -P sync $destination/com.restphone.androidproguardscala.updatesite/target/repository/ s3://androidproguardscala/UpdateSiteForAndroidProguardScalaEcosystem/$dirname/
29 | ~/src/s3cmd/s3cmd -P sync $destination/com.restphone.androidproguardscala.updatesite/target/com.restphone.androidproguardscala.updatesite.zip s3://androidproguardscala/UpdateSiteForAndroidProguardScalaEcosystem/$dirname/
30 | done
31 | done
32 | done
33 |
--------------------------------------------------------------------------------
/changeVersion.sh:
--------------------------------------------------------------------------------
1 | cd com.restphone.androidproguardscala.parent
2 | # mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=0.0.$1
3 | mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=0.0.$1-SNAPSHOT
4 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.restphone.androidproguardscala.feature
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.m2e.core.maven2Builder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.FeatureBuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.m2e.core.maven2Nature
21 | org.eclipse.pde.FeatureNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/README:
--------------------------------------------------------------------------------
1 | This repository is almost completely uninteresting unless you need to deploy AndroidProguardScala to a repository.
2 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/build.properties:
--------------------------------------------------------------------------------
1 | bin.includes = feature.xml
2 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/feature.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Eclipse plugin to improve the Scala development experience on Android.
6 |
7 |
8 |
9 | Copyright 2012
10 |
11 |
12 |
13 | Copyright (C) 2013 James Moore
14 |
15 | This program is free software; you can redistribute it and/or
16 | modify it under the terms of the GNU General Public License
17 | as published by the Free Software Foundation; either version 2
18 | of the License, or (at your option) any later version.
19 |
20 | This program is distributed in the hope that it will be useful,
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | GNU General Public License for more details.
24 |
25 | You should have received a copy of the GNU General Public License
26 | along with this program; if not, write to the Free Software
27 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.feature/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 | com.restphone.androidproguardscala.feature
4 | eclipse-feature
5 |
6 | com.restphone
7 | com.restphone.androidproguardscala.parent
8 | 0.0.51-SNAPSHOT
9 | ../com.restphone.androidproguardscala.parent
10 |
11 |
12 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.parent/.gitignore:
--------------------------------------------------------------------------------
1 | #Android generated
2 | bin
3 | gen
4 |
5 | #Eclipse
6 | .project
7 | .classpath
8 | .settings
9 | .metadata
10 |
11 | #IntelliJ IDEA
12 | .idea
13 | *.iml
14 | *.ipr
15 | *.iws
16 |
17 | #Maven
18 | target
19 | release.properties
20 | pom.xml.*
21 |
22 | # Emacs
23 | *~
24 |
25 | website/_site
26 |
27 | #Ant
28 | build.xml
29 | local.properties
30 | proguard.cfg
31 |
32 | #OSX
33 | .DS_Store
34 |
35 | proguard_cache
36 | proguard_cache_conf
37 |
38 | lib
39 | libs
40 | .cache
41 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.parent/cmds:
--------------------------------------------------------------------------------
1 | # Note that this is just notes to myself for now
2 |
3 | ~/src/s3cmd/s3cmd del --recursive s3://androidproguardscala/UpdateSiteForAndroidProguardScala/
4 | ~/src/s3cmd/s3cmd -P sync /Users/james/workspace/com.restphone.androidproguardscala.updatesite/target/repository/ s3://androidproguardscala/UpdateSiteForAndroidProguardScala/
5 | ( cd ~/workspace/AndroidProguardScala ; sh -x jarbuild.sh ; cd ../com.restphone.androidproguardscala.parent/ ; mvn clean install )
6 |
7 |
8 | for i in AndroidProguardScala AndroidProguardScalaFeature com.restphone.androidproguardscala.parent com.restphone.androidproguardscala.updatesite Jartender JavaSignatureParser/ ; do ( cd $i ; git push --tags ; ) ; done
9 |
10 | # Then set a new version
11 | mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=0.0.45-SNAPSHOT
12 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.parent/pom.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 | com.restphone
7 | com.restphone.androidproguardscala.parent
8 | 0.0.51-SNAPSHOT
9 | pom
10 |
11 | UTF-8
12 | 0.14.1
13 | http://download.eclipse.org/releases/indigo/
14 | http://download.scala-ide.org/ecosystem/
15 | ${repo.scala-ide.root}/scala210/dev/base/
16 | 2.11.0
17 | 4.10
18 | 2_09
19 | local
20 |
21 |
22 |
23 |
24 |
25 |
26 | net.alchim31.maven
27 | scala-maven-plugin
28 | 3.1.3
29 |
30 |
31 | process-resources
32 |
33 | compile
34 |
35 |
36 |
37 |
38 |
39 | -Xms1512m
40 | -Xmx4024m
41 |
42 | ${scala.version}
43 | true
44 |
45 |
46 |
47 | org.apache.maven.plugins
48 | maven-source-plugin
49 | 2.1.2
50 |
51 |
52 | attach-sources
53 |
54 | jar
55 |
56 |
57 |
58 |
59 |
60 | org.eclipse.tycho
61 | tycho-maven-plugin
62 | ${tycho.version}
63 | true
64 |
65 |
66 | org.eclipse.tycho
67 | tycho-compiler-plugin
68 | ${tycho.version}
69 |
70 |
71 | **/*.scala
72 |
73 |
74 |
75 |
76 | org.eclipse.tycho
77 | tycho-source-plugin
78 | ${tycho.version}
79 |
80 |
81 | attach-source
82 |
83 | plugin-source
84 |
85 |
86 |
87 |
88 |
89 | org.eclipse.tycho
90 | tycho-packaging-plugin
91 | ${tycho.version}
92 |
93 | true
94 |
95 |
96 |
97 |
98 |
99 |
100 | org.eclipse.tycho
101 | tycho-maven-plugin
102 | ${tycho.version}
103 | true
104 |
105 |
106 | org.eclipse.tycho
107 | tycho-versions-plugin
108 | ${tycho.version}
109 |
110 |
111 |
112 |
113 |
114 | eclipse
115 | p2
116 | ${repo.eclipse}
117 |
118 |
119 | snapshots
120 | http://localhost:8081/nexus/content/groups/public
121 |
122 | true
123 | interval:1
124 |
125 |
126 | false
127 |
128 |
129 |
130 | localReleases
131 | http://localhost:8081/nexus/content/groups/public
132 |
133 | true
134 |
135 |
136 |
137 | sonatype.release
138 | Sonatype maven release repository
139 | https://oss.sonatype.org/content/repositories/releases/
140 |
141 | false
142 |
143 |
144 |
145 | sonatype.snapshot
146 | Sonatype maven snapshot repository
147 | https://oss.sonatype.org/content/repositories/snapshots
148 |
149 | daily
150 |
151 |
152 |
153 | scala-ide
154 | Scala IDE p2 repository
155 | p2
156 | http://download.scala-ide.org/ecosystem/e37/scala210/dev/site
157 |
158 |
159 |
160 |
161 | ../com.restphone.androidproguardscala.plugin
162 |
163 |
164 | ../com.restphone.androidproguardscala.feature
165 |
166 |
167 | ../com.restphone.androidproguardscala.updatesite
168 |
169 |
170 |
171 |
172 |
173 |
174 | com.google.guava
175 | guava
176 | 16.0.1
177 |
178 |
179 | junit
180 | junit
181 | ${junit.version}
182 |
183 |
184 | com.restphone
185 | androidproguardscalalib_2.11
186 | 0.6-SNAPSHOT
187 |
188 |
189 | org.ow2.asm
190 | asm
191 | 4.1
192 |
193 |
194 | org.scala-lang
195 | scala-xml
196 | 2.11.0-M4
197 |
198 |
199 | org.scala-lang
200 | scala-parser-combinators
201 | 2.11.0-M4
202 |
203 |
204 | org.scala-lang
205 | scala-library
206 | 2.11.0
207 |
208 |
209 |
210 |
211 |
212 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/.externalToolBuilders/org.eclipse.pde.api.tools.apiAnalysisBuilder.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.restphone.androidproguardscala.plugin
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.pde.ManifestBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.pde.SchemaBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.ui.externaltools.ExternalToolBuilder
20 | full,incremental,
21 |
22 |
23 | LaunchConfigHandle
24 | <project>/.externalToolBuilders/org.eclipse.pde.api.tools.apiAnalysisBuilder.launch
25 |
26 |
27 |
28 |
29 | org.scala-ide.sdt.core.scalabuilder
30 |
31 |
32 |
33 |
34 |
35 | org.scala-ide.sdt.core.scalanature
36 | org.eclipse.pde.PluginNature
37 | org.eclipse.jdt.core.javanature
38 | org.eclipse.pde.api.tools.apiAnalysisNature
39 |
40 |
41 |
42 | .ivy2
43 | 2
44 | /Users/james/eclipseIndigo/Eclipse.app/Contents/MacOS/C::/Users/james/eclipseIndigo/Eclipse.app/Contents/MacOS/C::/Users/james/.ivy2
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4 | org.eclipse.jdt.core.compiler.compliance=1.6
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.6
9 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Bundle-ManifestVersion: 2
3 | Eclipse-BundleShape: dir
4 | Bundle-Name: AndroidProguardScala - a builder for speeding up builds of Scala for Android
5 | Bundle-SymbolicName: com.restphone.androidproguardscala;singleton:=true
6 | Bundle-Version: 0.0.51.qualifier
7 | Require-Bundle: org.eclipse.core.resources,
8 | org.eclipse.core.runtime,
9 | org.eclipse.ui,
10 | org.eclipse.jdt.core;bundle-version="3.6.2"
11 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6
12 | Export-Package: com.restphone.androidproguardscala
13 | Bundle-ClassPath: target/classes/,
14 | .,
15 | lib/androidproguardscalalib_2.11-0.6-SNAPSHOT.jar,
16 | lib/asm-4.1.jar,
17 | lib/guava-16.0.1.jar,
18 | lib/jartender_2.11-0.7-SNAPSHOT.jar,
19 | lib/javasignatureparser_2.11-0.7-SNAPSHOT.jar,
20 | lib/proguard-base-4.10.jar,
21 | lib/scalaz-core_2.11-7.0.6.jar,
22 | lib/scala-xml_2.11-1.0.1.jar,
23 | lib/scala-parser-combinators_2.11-1.0.1.jar,
24 | lib/scala-library_2.11-1.0.0.jar
25 | Bundle-ActivationPolicy: lazy
26 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/README.windows:
--------------------------------------------------------------------------------
1 | java -jar c:/Users/james/eclipse/plugins/org.apache.ivy.eclipse.ant_2.3.0.cr2_20121105223351/ivy.jar -settings ../ivysettings.xml -retrieve "lib/[module]-[type]-[artifact]-[revision].[ext]" ; rm lib/*source* ; rm lib/*javadoc* ; ls -l lib
2 |
3 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/build.properties:
--------------------------------------------------------------------------------
1 | source.. = src/main/java, src/main/scala
2 | output.. = bin/
3 | bin.includes = plugin.xml,\
4 | META-INF/,\
5 | .,\
6 | target/classes/,\
7 | COPYING,\
8 | proguard_cache/,\
9 | proguard_cache_conf/,\
10 | lib/androidproguardscalalib_2.11-0.6-SNAPSHOT.jar,\
11 | lib/asm-4.1.jar,\
12 | lib/guava-16.0.1.jar,\
13 | lib/jartender_2.11-0.7-SNAPSHOT.jar,\
14 | lib/javasignatureparser_2.11-0.7-SNAPSHOT.jar,\
15 | lib/proguard-base-4.10.jar,\
16 | lib/scalaz-core_2.11-7.0.6.jar,\
17 | lib/scala-xml_2.11-1.0.1.jar,\
18 | lib/scala-parser-combinators_2.11-1.0.1.jar,\
19 | lib/scala-library_2.11-1.0.0.jar
20 | src.includes = \
21 | docs/,\
22 | src/,\
23 | COPYING
24 | jars.compile.order = .
25 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/docs/GPL.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GNU General Public License
5 |
6 |
7 |
34 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.
35 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
36 |
37 | Everyone is permitted to copy and distribute verbatim copies
38 | of this license document, but changing it is not allowed.
39 |
46 | The licenses for most software are designed to take away your
47 | freedom to share and change it. By contrast, the GNU General Public
48 | License is intended to guarantee your freedom to share and change free
49 | software--to make sure the software is free for all its users. This
50 | General Public License applies to most of the Free Software
51 | Foundation's software and to any other program whose authors commit to
52 | using it. (Some other Free Software Foundation software is covered by
53 | the GNU Library General Public License instead.) You can apply it to
54 | your programs, too.
55 |
56 |
57 |
58 | When we speak of free software, we are referring to freedom, not
59 | price. Our General Public Licenses are designed to make sure that you
60 | have the freedom to distribute copies of free software (and charge for
61 | this service if you wish), that you receive source code or can get it
62 | if you want it, that you can change the software or use pieces of it
63 | in new free programs; and that you know you can do these things.
64 |
65 |
66 |
67 | To protect your rights, we need to make restrictions that forbid
68 | anyone to deny you these rights or to ask you to surrender the rights.
69 | These restrictions translate to certain responsibilities for you if you
70 | distribute copies of the software, or if you modify it.
71 |
72 |
73 |
74 | For example, if you distribute copies of such a program, whether
75 | gratis or for a fee, you must give the recipients all the rights that
76 | you have. You must make sure that they, too, receive or can get the
77 | source code. And you must show them these terms so they know their
78 | rights.
79 |
80 |
81 |
82 | We protect your rights with two steps: (1) copyright the software, and
83 | (2) offer you this license which gives you legal permission to copy,
84 | distribute and/or modify the software.
85 |
86 |
87 |
88 | Also, for each author's protection and ours, we want to make certain
89 | that everyone understands that there is no warranty for this free
90 | software. If the software is modified by someone else and passed on, we
91 | want its recipients to know that what they have is not the original, so
92 | that any problems introduced by others will not reflect on the original
93 | authors' reputations.
94 |
95 |
96 |
97 | Finally, any free program is threatened constantly by software
98 | patents. We wish to avoid the danger that redistributors of a free
99 | program will individually obtain patent licenses, in effect making the
100 | program proprietary. To prevent this, we have made it clear that any
101 | patent must be licensed for everyone's free use or not licensed at all.
102 |
103 |
104 |
105 | The precise terms and conditions for copying, distribution and
106 | modification follow.
107 |
108 |
115 |
116 | 0.
117 | This License applies to any program or other work which contains
118 | a notice placed by the copyright holder saying it may be distributed
119 | under the terms of this General Public License. The "Program", below,
120 | refers to any such program or work, and a "work based on the Program"
121 | means either the Program or any derivative work under copyright law:
122 | that is to say, a work containing the Program or a portion of it,
123 | either verbatim or with modifications and/or translated into another
124 | language. (Hereinafter, translation is included without limitation in
125 | the term "modification".) Each licensee is addressed as "you".
126 |
127 |
128 | Activities other than copying, distribution and modification are not
129 | covered by this License; they are outside its scope. The act of
130 | running the Program is not restricted, and the output from the Program
131 | is covered only if its contents constitute a work based on the
132 | Program (independent of having been made by running the Program).
133 | Whether that is true depends on what the Program does.
134 |
135 |
136 |
137 | 1.
138 | You may copy and distribute verbatim copies of the Program's
139 | source code as you receive it, in any medium, provided that you
140 | conspicuously and appropriately publish on each copy an appropriate
141 | copyright notice and disclaimer of warranty; keep intact all the
142 | notices that refer to this License and to the absence of any warranty;
143 | and give any other recipients of the Program a copy of this License
144 | along with the Program.
145 |
146 |
147 | You may charge a fee for the physical act of transferring a copy, and
148 | you may at your option offer warranty protection in exchange for a fee.
149 |
150 |
151 | 2.
152 | You may modify your copy or copies of the Program or any portion
153 | of it, thus forming a work based on the Program, and copy and
154 | distribute such modifications or work under the terms of Section 1
155 | above, provided that you also meet all of these conditions:
156 |
157 |
158 |
159 |
160 |
a)
161 | You must cause the modified files to carry prominent notices
162 | stating that you changed the files and the date of any change.
163 |
164 |
165 |
b)
166 | You must cause any work that you distribute or publish, that in
167 | whole or in part contains or is derived from the Program or any
168 | part thereof, to be licensed as a whole at no charge to all third
169 | parties under the terms of this License.
170 |
171 |
172 |
c)
173 | If the modified program normally reads commands interactively
174 | when run, you must cause it, when started running for such
175 | interactive use in the most ordinary way, to print or display an
176 | announcement including an appropriate copyright notice and a
177 | notice that there is no warranty (or else, saying that you provide
178 | a warranty) and that users may redistribute the program under
179 | these conditions, and telling the user how to view a copy of this
180 | License. (Exception: if the Program itself is interactive but
181 | does not normally print such an announcement, your work based on
182 | the Program is not required to print an announcement.)
183 |
184 |
185 | These requirements apply to the modified work as a whole. If
186 | identifiable sections of that work are not derived from the Program,
187 | and can be reasonably considered independent and separate works in
188 | themselves, then this License, and its terms, do not apply to those
189 | sections when you distribute them as separate works. But when you
190 | distribute the same sections as part of a whole which is a work based
191 | on the Program, the distribution of the whole must be on the terms of
192 | this License, whose permissions for other licensees extend to the
193 | entire whole, and thus to each and every part regardless of who wrote it.
194 |
195 |
196 | Thus, it is not the intent of this section to claim rights or contest
197 | your rights to work written entirely by you; rather, the intent is to
198 | exercise the right to control the distribution of derivative or
199 | collective works based on the Program.
200 |
201 |
202 | In addition, mere aggregation of another work not based on the Program
203 | with the Program (or with a work based on the Program) on a volume of
204 | a storage or distribution medium does not bring the other work under
205 | the scope of this License.
206 |
207 |
208 |
209 | 3.
210 | You may copy and distribute the Program (or a work based on it,
211 | under Section 2) in object code or executable form under the terms of
212 | Sections 1 and 2 above provided that you also do one of the following:
213 |
214 |
215 |
216 |
217 |
218 |
219 |
a)
220 | Accompany it with the complete corresponding machine-readable
221 | source code, which must be distributed under the terms of Sections
222 | 1 and 2 above on a medium customarily used for software interchange; or,
223 |
224 |
225 |
b)
226 | Accompany it with a written offer, valid for at least three
227 | years, to give any third party, for a charge no more than your
228 | cost of physically performing source distribution, a complete
229 | machine-readable copy of the corresponding source code, to be
230 | distributed under the terms of Sections 1 and 2 above on a medium
231 | customarily used for software interchange; or,
232 |
233 |
234 |
c)
235 | Accompany it with the information you received as to the offer
236 | to distribute corresponding source code. (This alternative is
237 | allowed only for noncommercial distribution and only if you
238 | received the program in object code or executable form with such
239 | an offer, in accord with Subsection b above.)
240 |
241 |
242 | The source code for a work means the preferred form of the work for
243 | making modifications to it. For an executable work, complete source
244 | code means all the source code for all modules it contains, plus any
245 | associated interface definition files, plus the scripts used to
246 | control compilation and installation of the executable. However, as a
247 | special exception, the source code distributed need not include
248 | anything that is normally distributed (in either source or binary
249 | form) with the major components (compiler, kernel, and so on) of the
250 | operating system on which the executable runs, unless that component
251 | itself accompanies the executable.
252 |
253 |
254 | If distribution of executable or object code is made by offering
255 | access to copy from a designated place, then offering equivalent
256 | access to copy the source code from the same place counts as
257 | distribution of the source code, even though third parties are not
258 | compelled to copy the source along with the object code.
259 |
260 |
261 | 4.
262 | You may not copy, modify, sublicense, or distribute the Program
263 | except as expressly provided under this License. Any attempt
264 | otherwise to copy, modify, sublicense or distribute the Program is
265 | void, and will automatically terminate your rights under this License.
266 | However, parties who have received copies, or rights, from you under
267 | this License will not have their licenses terminated so long as such
268 | parties remain in full compliance.
269 |
270 |
271 |
272 | 5.
273 | You are not required to accept this License, since you have not
274 | signed it. However, nothing else grants you permission to modify or
275 | distribute the Program or its derivative works. These actions are
276 | prohibited by law if you do not accept this License. Therefore, by
277 | modifying or distributing the Program (or any work based on the
278 | Program), you indicate your acceptance of this License to do so, and
279 | all its terms and conditions for copying, distributing or modifying
280 | the Program or works based on it.
281 |
282 |
283 |
284 | 6.
285 | Each time you redistribute the Program (or any work based on the
286 | Program), the recipient automatically receives a license from the
287 | original licensor to copy, distribute or modify the Program subject to
288 | these terms and conditions. You may not impose any further
289 | restrictions on the recipients' exercise of the rights granted herein.
290 | You are not responsible for enforcing compliance by third parties to
291 | this License.
292 |
293 |
294 |
295 | 7.
296 | If, as a consequence of a court judgment or allegation of patent
297 | infringement or for any other reason (not limited to patent issues),
298 | conditions are imposed on you (whether by court order, agreement or
299 | otherwise) that contradict the conditions of this License, they do not
300 | excuse you from the conditions of this License. If you cannot
301 | distribute so as to satisfy simultaneously your obligations under this
302 | License and any other pertinent obligations, then as a consequence you
303 | may not distribute the Program at all. For example, if a patent
304 | license would not permit royalty-free redistribution of the Program by
305 | all those who receive copies directly or indirectly through you, then
306 | the only way you could satisfy both it and this License would be to
307 | refrain entirely from distribution of the Program.
308 |
309 |
310 | If any portion of this section is held invalid or unenforceable under
311 | any particular circumstance, the balance of the section is intended to
312 | apply and the section as a whole is intended to apply in other
313 | circumstances.
314 |
315 |
316 | It is not the purpose of this section to induce you to infringe any
317 | patents or other property right claims or to contest validity of any
318 | such claims; this section has the sole purpose of protecting the
319 | integrity of the free software distribution system, which is
320 | implemented by public license practices. Many people have made
321 | generous contributions to the wide range of software distributed
322 | through that system in reliance on consistent application of that
323 | system; it is up to the author/donor to decide if he or she is willing
324 | to distribute software through any other system and a licensee cannot
325 | impose that choice.
326 |
327 |
328 | This section is intended to make thoroughly clear what is believed to
329 | be a consequence of the rest of this License.
330 |
331 |
332 |
333 | 8.
334 | If the distribution and/or use of the Program is restricted in
335 | certain countries either by patents or by copyrighted interfaces, the
336 | original copyright holder who places the Program under this License
337 | may add an explicit geographical distribution limitation excluding
338 | those countries, so that distribution is permitted only in or among
339 | countries not thus excluded. In such case, this License incorporates
340 | the limitation as if written in the body of this License.
341 |
342 |
343 |
344 | 9.
345 | The Free Software Foundation may publish revised and/or new versions
346 | of the General Public License from time to time. Such new versions will
347 | be similar in spirit to the present version, but may differ in detail to
348 | address new problems or concerns.
349 |
350 |
351 | Each version is given a distinguishing version number. If the Program
352 | specifies a version number of this License which applies to it and "any
353 | later version", you have the option of following the terms and conditions
354 | either of that version or of any later version published by the Free
355 | Software Foundation. If the Program does not specify a version number of
356 | this License, you may choose any version ever published by the Free Software
357 | Foundation.
358 |
359 |
360 |
361 |
362 | 10.
363 | If you wish to incorporate parts of the Program into other free
364 | programs whose distribution conditions are different, write to the author
365 | to ask for permission. For software which is copyrighted by the Free
366 | Software Foundation, write to the Free Software Foundation; we sometimes
367 | make exceptions for this. Our decision will be guided by the two goals
368 | of preserving the free status of all derivatives of our free software and
369 | of promoting the sharing and reuse of software generally.
370 |
371 |
372 |
373 |
NO WARRANTY
374 |
375 |
376 |
377 | 11.
378 | BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
379 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
380 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
381 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
382 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
383 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
384 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
385 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
386 | REPAIR OR CORRECTION.
387 |
388 |
389 |
390 | 12.
391 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
392 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
393 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
394 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
395 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
396 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
397 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
398 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
399 | POSSIBILITY OF SUCH DAMAGES.
400 |
401 |
402 |
403 |
404 |
END OF TERMS AND CONDITIONS
405 |
406 |
407 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/docs/GPL_exception.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Special Exception to the GNU General Public License
5 |
6 |
7 |
Special Exception to the GNU General Public License
14 | This program is free software; you can redistribute it and/or modify it under
15 | the terms of the GNU General Public License as published by the Free Software
16 | Foundation; either version 2 of the License, or (at your option) any later
17 | version.
18 |
19 |
20 |
21 | This program is distributed in the hope that it will be useful, but WITHOUT
22 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
23 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24 |
25 |
26 |
27 | You should have received a copy of the GNU General Public License along with
28 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
29 | Place, Suite 330, Boston, MA 02111-1307 USA
30 |
31 |
32 |
33 | In addition, as a special exception, Eric Lafortune gives permission to link
34 | the code of this program with the following stand-alone applications:
35 |
36 |
Apache Ant,
37 |
Apache Maven,
38 |
the Eclipse ProGuardDT GUI,
39 |
the EclipseME JME IDE,
40 |
the Sun NetBeans Java IDE,
41 |
the Sun JME Wireless Toolkit,
42 |
the Javaground Tools, and
43 |
the Sanaware Tools,
44 |
45 | and distribute linked combinations including the two. You must obey the GNU
46 | General Public License in all respects for all of the code used other than
47 | these programs. If you modify this file, you may extend this exception to your
48 | version of the file, but you are not obligated to do so. If you do not wish to
49 | do so, delete this exception statement from your version.
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/ecosystem-build.sh:
--------------------------------------------------------------------------------
1 | # from https://github.com/scalatest/scalatest-eclipse-plugin/blob/master/ecosystem-build.sh
2 | #
3 | #!/bin/bash
4 |
5 |
6 | ####################
7 | #
8 | # $1 - build profile
9 | # $2 - ecosystem location
10 | # $3 - scala version
11 | # $4 - ecosystem id
12 | # $5 - eclipse ecosystem
13 | #
14 | ####################
15 | function build() {
16 | cd ${ROOT_DIR}
17 | mvn -Pset-versions -P$1 -Drepo.scala-ide=$2 -Dscala.version=$3 -Drepo.eclipse=$5 -Dtycho.style=maven --non-recursive exec:java
18 |
19 | mvn -Pset-versions -P$1 -Drepo.scala-ide=$2 -Dscala.version=$3 -Drepo.eclipse=$5 clean package
20 |
21 | rm -rf ${TARGET_DIR}/$4
22 | mkdir -p ${TARGET_DIR}
23 |
24 | cp -r ${ROOT_DIR}/org.scala-ide.sdt.scalatest.update-site/target/site/ ${TARGET_DIR}/$4
25 | }
26 |
27 | ###################
28 |
29 | # root dir (containing this script)
30 | ROOT_DIR=$(dirname $0)
31 | cd ${ROOT_DIR}
32 | ROOT_DIR=${PWD}
33 |
34 | TARGET_DIR=~/tmp/scalatest-build-ecosystem
35 |
36 | # scala-ide/build-tools/maven-tool/merge-site/ location
37 | MERGE_TOOL_DIR=~/git/build-tools/maven-tool/merge-site
38 |
39 | ###################
40 |
41 | set -x
42 |
43 | rm -rf ${TARGET_DIR}
44 |
45 | #build scala-ide-master-scala-2.9 http://download.scala-ide.org/ecosystem/e37/scala29/dev/site/ 2.9.3-scala-ide-m2 e37-scala29-dev http://download.eclipse.org/releases/indigo/
46 | #build scala-ide-master-scala-2.9 http://download.scala-ide.org/ecosystem/e38/scala29/dev/site/ 2.9.3-scala-ide-m2 e38-scala29-dev http://download.eclipse.org/releases/juno/
47 | #build scala-ide-master-scala-trunk http://download.scala-ide.org/ecosystem/e37/scala29/dev/site/ 2.10.0-RC1 e37-scala210-dev http://download.eclipse.org/releases/indigo/
48 | #build scala-ide-master-scala-trunk http://download.scala-ide.org/ecosystem/e38/scala29/dev/site/ 2.10.0-RC1 e38-scala210-dev http://download.eclipse.org/releases/juno/
49 | # build scala-ide-2.1-m3 http://download.scala-ide.org/ecosystem/next/e37/scala29/dev/base/ 2.9.3-RC2 e37-scala29-m3 http://download.eclipse.org/releases/indigo/
50 | # build scala-ide-2.1-m3 http://download.scala-ide.org/ecosystem/next/e38/scala29/dev/base/ 2.9.3-RC2 e38-scala29-m3 http://download.eclipse.org/releases/juno/
51 | build scala-ide-2.1-m3-2_10 http://download.scala-ide.org/sdk/next/e37/scala210/dev/base/ 2.10.0 e37-scala210-m3 http://download.eclipse.org/releases/indigo/
52 | # build scala-ide-2.1-m3-2_10 http://download.scala-ide.org/sdk/next/e38/scala210/dev/base/ 2.10.0 e38-scala210-m3 http://download.eclipse.org/releases/juno/
53 | # build scala-ide-2.0.2 http://download.scala-ide.org/sdk/e37/scala29/stable/site/ 2.9.2 e37-scala29-2.0.2 http://download.eclipse.org/releases/indigo/
54 |
55 | cd ${MERGE_TOOL_DIR}
56 | #mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e37-scala29-dev package
57 | #mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e38-scala29-dev package
58 | #mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e37-scala210-dev package
59 | #mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e38-scala210-dev package
60 | # mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e37-scala29-m3 package
61 | # mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e38-scala29-m3 package
62 | # mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e37-scala210-m3 package
63 | # mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e38-scala210-m3 package
64 | # mvn -Drepo.dest=${TARGET_DIR}/combined -Drepo.source=file://${TARGET_DIR}/e37-scala29-2.0.2 package
65 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/lib/scala-library_2.11-1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/banshee/AndroidProguardScala/854e5f89e546c4e211ad02676ad601d1e00c0789/com.restphone.androidproguardscala.plugin/lib/scala-library_2.11-1.0.0.jar
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
9 |
11 |
13 |
14 |
15 |
16 |
20 |
21 |
23 |
24 |
25 |
27 |
28 |
29 |
31 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
52 |
57 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
73 |
75 |
76 |
78 |
79 |
80 |
82 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
96 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | 4.0.0
7 |
8 | 3.0
9 |
10 | com.restphone.androidproguardscala
11 | eclipse-plugin
12 |
13 | com.restphone
14 | com.restphone.androidproguardscala.parent
15 | 0.0.51-SNAPSHOT
16 | ../com.restphone.androidproguardscala.parent
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | com.google.guava
25 | guava
26 |
27 |
28 | junit
29 | junit
30 |
31 |
32 | com.restphone
33 | androidproguardscalalib_2.11
34 |
35 |
36 | org.ow2.asm
37 | asm
38 |
39 |
40 |
41 |
42 |
43 |
44 | net.alchim31.maven
45 | scala-maven-plugin
46 |
47 |
48 | org.apache.maven.plugins
49 | maven-dependency-plugin
50 |
51 |
52 | default-cli
53 | process-resources
54 |
55 | copy-dependencies
56 |
57 |
58 | ./lib
59 | androidproguardscalalib_2.11,scala-library_2.11,scala-xml_2.11,scala-parser-combinators_2.11,asm,guava,jartender_2.11,javasignatureparser_2.11,proguard-base,scalaz-core_2.11,jsr305
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/proguard_cache/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/banshee/AndroidProguardScala/854e5f89e546c4e211ad02676ad601d1e00c0789/com.restphone.androidproguardscala.plugin/proguard_cache/.keep
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/proguard_cache_conf/proguard_additions.conf:
--------------------------------------------------------------------------------
1 | # Fix for https://issues.scala-lang.org/browse/SI-5397
2 |
3 | -keep class scala.collection.SeqLike {
4 | public protected *;
5 | }
6 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/proguard_cache_conf/proguard_defaults.conf:
--------------------------------------------------------------------------------
1 | -keep public class * extends android.**
2 | -dontwarn **$$anonfun$*
3 | -dontwarn
4 | -dontoptimize
5 | -dontobfuscate
6 | -dontskipnonpubliclibraryclasses
7 | -dontskipnonpubliclibraryclassmembers
8 |
9 | -ignorewarnings
10 | -forceprocessing
11 |
12 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated,
13 | SourceFile,LineNumberTable,*Annotation*,EnclosingMethod
14 |
15 | -keep public class scala.ScalaObject { *; }
16 | -keep public class scala.Function0, scala.Function1
17 |
18 | # Fix for https://issues.scala-lang.org/browse/SI-5397
19 |
20 | -keep class scala.collection.SeqLike {
21 | public protected *;
22 | }
23 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/.keepdir:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/banshee/AndroidProguardScala/854e5f89e546c4e211ad02676ad601d1e00c0789/com.restphone.androidproguardscala.plugin/src/main/java/.keepdir
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/bdaum/overlayPages/FieldEditorOverlayPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2003 Berthold Daum.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Common Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/cpl-v10.html
7 | *
8 | * Contributors:
9 | * Berthold Daum
10 | *******************************************************************************/
11 | package com.bdaum.overlayPages;
12 |
13 | import java.util.ArrayList;
14 | import java.util.Iterator;
15 | import java.util.List;
16 |
17 | import org.eclipse.core.resources.IResource;
18 | import org.eclipse.core.runtime.CoreException;
19 | import org.eclipse.core.runtime.IAdaptable;
20 | import org.eclipse.core.runtime.QualifiedName;
21 | import org.eclipse.jface.preference.FieldEditor;
22 | import org.eclipse.jface.preference.FieldEditorPreferencePage;
23 | import org.eclipse.jface.preference.IPreferenceNode;
24 | import org.eclipse.jface.preference.IPreferencePage;
25 | import org.eclipse.jface.preference.IPreferenceStore;
26 | import org.eclipse.jface.preference.PreferenceDialog;
27 | import org.eclipse.jface.preference.PreferenceManager;
28 | import org.eclipse.jface.preference.PreferenceNode;
29 | import org.eclipse.jface.resource.ImageDescriptor;
30 | import org.eclipse.swt.SWT;
31 | import org.eclipse.swt.custom.BusyIndicator;
32 | import org.eclipse.swt.events.SelectionAdapter;
33 | import org.eclipse.swt.events.SelectionEvent;
34 | import org.eclipse.swt.layout.GridData;
35 | import org.eclipse.swt.layout.GridLayout;
36 | import org.eclipse.swt.widgets.Button;
37 | import org.eclipse.swt.widgets.Composite;
38 | import org.eclipse.swt.widgets.Control;
39 | import org.eclipse.ui.IWorkbenchPropertyPage;
40 |
41 | /**
42 | * @author Berthold Daum
43 | */
44 | public abstract class FieldEditorOverlayPage
45 | extends FieldEditorPreferencePage
46 | implements IWorkbenchPropertyPage {
47 |
48 | /*** Name of resource property for the selection of workbench or project settings ***/
49 | public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
50 |
51 | private static final String FALSE = "false"; //$NON-NLS-1$
52 | private static final String TRUE = "true"; //$NON-NLS-1$
53 |
54 | // Stores all created field editors
55 | private List editors = new ArrayList();
56 |
57 | // Stores owning element of properties
58 | private IAdaptable element;
59 |
60 | // Additional buttons for property pages
61 | private Button useWorkspaceSettingsButton,
62 | useProjectSettingsButton,
63 | configureButton;
64 |
65 | // Overlay preference store for property pages
66 | private IPreferenceStore overlayStore;
67 |
68 | // The image descriptor of this pages title image
69 | private ImageDescriptor image;
70 |
71 | // Cache for page id
72 | private String pageId;
73 |
74 | /**
75 | * Constructor
76 | * @param style - layout style
77 | */
78 | public FieldEditorOverlayPage(int style) {
79 | super(style);
80 | }
81 |
82 | /**
83 | * Constructor
84 | * @param title - title string
85 | * @param style - layout style
86 | */
87 | public FieldEditorOverlayPage(String title, int style) {
88 | super(title, style);
89 | }
90 |
91 | /**
92 | * Constructor
93 | * @param title - title string
94 | * @param image - title image
95 | * @param style - layout style
96 | */
97 | public FieldEditorOverlayPage(
98 | String title,
99 | ImageDescriptor image,
100 | int style) {
101 | super(title, image, style);
102 | this.image = image;
103 | }
104 |
105 | /**
106 | * Returns the id of the current preference page as defined in plugin.xml
107 | * Subclasses must implement.
108 | *
109 | * @return - the qualifier
110 | */
111 | protected abstract String getPageId();
112 |
113 | /**
114 | * Receives the object that owns the properties shown in this property page.
115 | * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
116 | */
117 | public void setElement(IAdaptable element) {
118 | this.element = element;
119 | }
120 |
121 | /**
122 | * Delivers the object that owns the properties shown in this property page.
123 | * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
124 | */
125 | public IAdaptable getElement() {
126 | return element;
127 | }
128 |
129 | /**
130 | * Returns true if this instance represents a property page
131 | * @return - true for property pages, false for preference pages
132 | */
133 | public boolean isPropertyPage() {
134 | return getElement() != null;
135 | }
136 |
137 | /**
138 | * We override the addField method. This allows us to store each field editor added by subclasses
139 | * in a list for later processing.
140 | *
141 | * @see org.eclipse.jface.preference.FieldEditorPreferencePage#addField(org.eclipse.jface.preference.FieldEditor)
142 | */
143 | protected void addField(FieldEditor editor) {
144 | editors.add(editor);
145 | super.addField(editor);
146 | }
147 |
148 | /**
149 | * We override the createControl method.
150 | * In case of property pages we create a new PropertyStore as local preference store.
151 | * After all control have been create, we enable/disable these controls.
152 | *
153 | * @see org.eclipse.jface.preference.PreferencePage#createControl()
154 | */
155 | public void createControl(Composite parent) {
156 | // Special treatment for property pages
157 | if (isPropertyPage()) {
158 | // Cache the page id
159 | pageId = getPageId();
160 | // Create an overlay preference store and fill it with properties
161 | overlayStore =
162 | new PropertyStore(
163 | (IResource) getElement(),
164 | super.getPreferenceStore(),
165 | pageId);
166 | // Set overlay store as current preference store
167 | }
168 | super.createControl(parent);
169 | // Update state of all subclass controls
170 | if (isPropertyPage())
171 | updateFieldEditors();
172 | }
173 |
174 | /**
175 | * We override the createContents method.
176 | * In case of property pages we insert two radio buttons at the top of the page.
177 | *
178 | * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
179 | */
180 | protected Control createContents(Composite parent) {
181 | if (isPropertyPage())
182 | createSelectionGroup(parent);
183 | return super.createContents(parent);
184 | }
185 |
186 | /**
187 | * Creates and initializes a selection group with two choice buttons and one push button.
188 | * @param parent - the parent composite
189 | */
190 | private void createSelectionGroup(Composite parent) {
191 | Composite comp = new Composite(parent, SWT.NONE);
192 | GridLayout layout = new GridLayout(2, false);
193 | layout.marginHeight = 0;
194 | layout.marginWidth = 0;
195 | comp.setLayout(layout);
196 | comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
197 | Composite radioGroup = new Composite(comp, SWT.NONE);
198 | radioGroup.setLayout(new GridLayout());
199 | radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
200 | useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
201 | useProjectSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
202 | configureButton = new Button(comp, SWT.PUSH);
203 | configureButton.setText(Messages.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
204 | configureButton.addSelectionListener(new SelectionAdapter() {
205 | public void widgetSelected(SelectionEvent e) {
206 | configureWorkspaceSettings();
207 | }
208 | });
209 | // Set workspace/project radio buttons
210 | try {
211 | String use =
212 | ((IResource) getElement()).getPersistentProperty(
213 | new QualifiedName(pageId, USEPROJECTSETTINGS));
214 | if (TRUE.equals(use)) {
215 | useProjectSettingsButton.setSelection(true);
216 | configureButton.setEnabled(false);
217 | } else
218 | useWorkspaceSettingsButton.setSelection(true);
219 | } catch (CoreException e) {
220 | useWorkspaceSettingsButton.setSelection(true);
221 | }
222 | }
223 |
224 | /**
225 | * Convenience method creating a radio button
226 | * @param parent - the parent composite
227 | * @param label - the button label
228 | * @return - the new button
229 | */
230 | private Button createRadioButton(Composite parent, String label) {
231 | final Button button = new Button(parent, SWT.RADIO);
232 | button.setText(label);
233 | button.addSelectionListener(new SelectionAdapter() {
234 | public void widgetSelected(SelectionEvent e) {
235 | configureButton.setEnabled(
236 | button == useWorkspaceSettingsButton);
237 | updateFieldEditors();
238 | }
239 | });
240 | return button;
241 | }
242 |
243 | /**
244 | * Returns in case of property pages the overlay store,
245 | * in case of preference pages the standard preference store
246 | * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
247 | */
248 | public IPreferenceStore getPreferenceStore() {
249 | if (isPropertyPage())
250 | return overlayStore;
251 | return super.getPreferenceStore();
252 | }
253 |
254 | /*
255 | * Enables or disables the field editors and buttons of this page
256 | */
257 | private void updateFieldEditors() {
258 | // We iterate through all field editors
259 | boolean enabled = useProjectSettingsButton.getSelection();
260 | updateFieldEditors(enabled);
261 | }
262 |
263 | /**
264 | * Enables or disables the field editors and buttons of this page
265 | * Subclasses may override.
266 | * @param enabled - true if enabled
267 | */
268 | protected void updateFieldEditors(boolean enabled) {
269 | Composite parent = getFieldEditorParent();
270 | Iterator it = editors.iterator();
271 | while (it.hasNext()) {
272 | FieldEditor editor = (FieldEditor) it.next();
273 | editor.setEnabled(enabled, parent);
274 | }
275 | }
276 |
277 | /**
278 | * We override the performOk method. In case of property pages we copy the values in the
279 | * overlay store into the property values of the selected project.
280 | * We also save the state of the radio buttons.
281 | *
282 | * @see org.eclipse.jface.preference.IPreferencePage#performOk()
283 | */
284 | public boolean performOk() {
285 | boolean result = super.performOk();
286 | if (result && isPropertyPage()) {
287 | // Save state of radiobuttons in project properties
288 | IResource resource = (IResource) getElement();
289 | try {
290 | String value =
291 | (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
292 | resource.setPersistentProperty(
293 | new QualifiedName(pageId, USEPROJECTSETTINGS),
294 | value);
295 | } catch (CoreException e) {
296 | }
297 | }
298 | return result;
299 | }
300 |
301 | /**
302 | * We override the performDefaults method. In case of property pages we
303 | * switch back to the workspace settings and disable the field editors.
304 | *
305 | * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
306 | */
307 | protected void performDefaults() {
308 | if (isPropertyPage()) {
309 | useWorkspaceSettingsButton.setSelection(true);
310 | useProjectSettingsButton.setSelection(false);
311 | configureButton.setEnabled(true);
312 | updateFieldEditors();
313 | }
314 | super.performDefaults();
315 | }
316 |
317 | /**
318 | * Creates a new preferences page and opens it
319 | * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
320 | */
321 | protected void configureWorkspaceSettings() {
322 | try {
323 | // create a new instance of the current class
324 | IPreferencePage page =
325 | (IPreferencePage) this.getClass().newInstance();
326 | page.setTitle(getTitle());
327 | page.setImageDescriptor(image);
328 | // and show it
329 | showPreferencePage(pageId, page);
330 | } catch (InstantiationException e) {
331 | e.printStackTrace();
332 | } catch (IllegalAccessException e) {
333 | e.printStackTrace();
334 | }
335 | }
336 |
337 | /**
338 | * Show a single preference pages
339 | * @param id - the preference page identification
340 | * @param page - the preference page
341 | */
342 | protected void showPreferencePage(String id, IPreferencePage page) {
343 | final IPreferenceNode targetNode = new PreferenceNode(id, page);
344 | PreferenceManager manager = new PreferenceManager();
345 | manager.addToRoot(targetNode);
346 | final PreferenceDialog dialog =
347 | new PreferenceDialog(getControl().getShell(), manager);
348 | BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
349 | public void run() {
350 | dialog.create();
351 | dialog.setMessage(targetNode.getLabelText());
352 | dialog.open();
353 | }
354 | });
355 | }
356 |
357 | }
358 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/bdaum/overlayPages/Messages.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2003 Berthold Daum.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Common Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/cpl-v10.html
7 | *
8 | * Contributors:
9 | * Berthold Daum
10 | *******************************************************************************/
11 |
12 | package com.bdaum.overlayPages;
13 |
14 | import java.util.ResourceBundle;
15 |
16 |
17 | public class Messages {
18 |
19 | private final static String RESOURCE_BUNDLE= "com.bdaum.overlayPages.Messages";//$NON-NLS-1$
20 |
21 | private static ResourceBundle fgResourceBundle = null;
22 |
23 | private static boolean notRead = true;
24 |
25 | public Messages() {
26 | }
27 | public static ResourceBundle getResourceBundle() {
28 | if (notRead) {
29 | notRead = false;
30 | try {
31 | fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
32 | }
33 | catch (Exception e) {
34 | }
35 | }
36 |
37 | return fgResourceBundle;
38 | }
39 | public static String getString(String key) {
40 | try {
41 | return getResourceBundle().getString(key);
42 | } catch (Exception e) {
43 | return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
44 | }
45 | }
46 | }
47 |
48 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/bdaum/overlayPages/Messages.properties:
--------------------------------------------------------------------------------
1 | OverlayPage.Use_Workspace_Settings=Use &workspace settings
2 | OverlayPage.Use_Project_Settings=Use pr&oject settings
3 | OverlayPage.Configure_Workspace_Settings=&Configure Workspace Settings ...
4 | PropertyStore.Cannot_write_resource_property=Cannot write resource property
5 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/bdaum/overlayPages/OverlayPage.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2003 Berthold Daum.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Common Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/cpl-v10.html
7 | *
8 | * Contributors:
9 | * Berthold Daum
10 | *******************************************************************************/
11 | package com.bdaum.overlayPages;
12 |
13 | import org.eclipse.core.resources.IResource;
14 | import org.eclipse.core.runtime.CoreException;
15 | import org.eclipse.core.runtime.QualifiedName;
16 | import org.eclipse.jface.preference.IPreferenceNode;
17 | import org.eclipse.jface.preference.IPreferencePage;
18 | import org.eclipse.jface.preference.IPreferenceStore;
19 | import org.eclipse.jface.preference.PreferenceDialog;
20 | import org.eclipse.jface.preference.PreferenceManager;
21 | import org.eclipse.jface.preference.PreferenceNode;
22 | import org.eclipse.jface.resource.ImageDescriptor;
23 | import org.eclipse.swt.SWT;
24 | import org.eclipse.swt.custom.BusyIndicator;
25 | import org.eclipse.swt.custom.CTabFolder;
26 | import org.eclipse.swt.events.SelectionAdapter;
27 | import org.eclipse.swt.events.SelectionEvent;
28 | import org.eclipse.swt.layout.GridData;
29 | import org.eclipse.swt.layout.GridLayout;
30 | import org.eclipse.swt.widgets.Button;
31 | import org.eclipse.swt.widgets.Composite;
32 | import org.eclipse.swt.widgets.Control;
33 | import org.eclipse.swt.widgets.TabFolder;
34 | import org.eclipse.ui.dialogs.PropertyPage;
35 | import org.eclipse.ui.part.PageBook;
36 |
37 | /**
38 | * @author Berthold Daum
39 | */
40 | public abstract class OverlayPage extends PropertyPage {
41 |
42 | /*** Name of resource property for the selection of workbench or project settings ***/
43 | public static final String USEPROJECTSETTINGS = "useProjectSettings"; //$NON-NLS-1$
44 |
45 | private static final String FALSE = "false"; //$NON-NLS-1$
46 | private static final String TRUE = "true"; //$NON-NLS-1$
47 |
48 | // Additional buttons for property pages
49 | private Button useWorkspaceSettingsButton,
50 | useProjectSettingsButton,
51 | configureButton;
52 |
53 | // Overlay preference store for property pages
54 | private PropertyStore overlayStore;
55 |
56 | // The image descriptor of this pages title image
57 | private ImageDescriptor image;
58 |
59 | // Cache for page id
60 | private String pageId;
61 |
62 | // Container for subclass controls
63 | private Composite contents;
64 |
65 | /**
66 | * Constructor
67 | */
68 | public OverlayPage() {
69 | super();
70 | }
71 |
72 | /**
73 | * Constructor
74 | * @param title - title string
75 | */
76 | public OverlayPage(String title) {
77 | super();
78 | setTitle(title);
79 | }
80 |
81 | /**
82 | * Constructor
83 | * @param title - title string
84 | * @param image - title image
85 | */
86 | public OverlayPage(String title, ImageDescriptor image) {
87 | super();
88 | setTitle(title);
89 | setImageDescriptor(image);
90 | this.image = image;
91 | }
92 |
93 | /**
94 | * Returns the id of the current preference page as defined in plugin.xml
95 | * Subclasses must implement.
96 | *
97 | * @return - the qualifier
98 | */
99 | protected abstract String getPageId();
100 |
101 | /**
102 | * Returns true if this instance represents a property page
103 | * @return - true for property pages, false for preference pages
104 | */
105 | public boolean isPropertyPage() {
106 | return getElement() != null;
107 | }
108 |
109 | /**
110 | * We need to implement createContents method. In case of property pages we insert two radio buttons
111 | * and a push button at the top of the page. Below this group we create a new composite for the contents
112 | * created by subclasses.
113 | *
114 | * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
115 | */
116 | protected Control createContents(Composite parent) {
117 | if (isPropertyPage())
118 | createSelectionGroup(parent);
119 | contents = new Composite(parent, SWT.NONE);
120 | GridLayout layout = new GridLayout();
121 | layout.marginHeight = 0;
122 | layout.marginWidth = 0;
123 | contents.setLayout(layout);
124 | contents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
125 | return contents;
126 | }
127 |
128 | /**
129 | * Creates and initializes a selection group with two choice buttons and one push button.
130 | * @param parent - the parent composite
131 | */
132 | private void createSelectionGroup(Composite parent) {
133 | Composite comp = new Composite(parent, SWT.NONE);
134 | GridLayout layout = new GridLayout(2, false);
135 | layout.marginHeight = 0;
136 | layout.marginWidth = 0;
137 | comp.setLayout(layout);
138 | comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
139 | Composite radioGroup = new Composite(comp, SWT.NONE);
140 | radioGroup.setLayout(new GridLayout());
141 | radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
142 | useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
143 | useProjectSettingsButton = createRadioButton(radioGroup, Messages.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
144 | configureButton = new Button(comp, SWT.PUSH);
145 | configureButton.setText(Messages.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
146 | configureButton.addSelectionListener(new SelectionAdapter() {
147 | public void widgetSelected(SelectionEvent e) {
148 | configureWorkspaceSettings();
149 | }
150 | });
151 | // Set workspace/project radio buttons
152 | try {
153 | String use =
154 | ((IResource) getElement()).getPersistentProperty(
155 | new QualifiedName(pageId, USEPROJECTSETTINGS));
156 | if (TRUE.equals(use)) {
157 | useProjectSettingsButton.setSelection(true);
158 | configureButton.setEnabled(false);
159 | } else
160 | useWorkspaceSettingsButton.setSelection(true);
161 | } catch (CoreException e) {
162 | useWorkspaceSettingsButton.setSelection(true);
163 | }
164 | }
165 |
166 | /**
167 | * Convenience method creating a radio button
168 | * @param parent - the parent composite
169 | * @param label - the button label
170 | * @return - the new button
171 | */
172 | private Button createRadioButton(Composite parent, String label) {
173 | final Button button = new Button(parent, SWT.RADIO);
174 | button.setText(label);
175 | button.addSelectionListener(new SelectionAdapter() {
176 | public void widgetSelected(SelectionEvent e) {
177 | configureButton.setEnabled(
178 | button == useWorkspaceSettingsButton);
179 | setControlsEnabled();
180 | }
181 | });
182 | return button;
183 | }
184 |
185 | /**
186 | * In case of property pages we create a new PropertyStore as local overlay store.
187 | * After all controls have been create, we enable/disable these controls
188 | *
189 | * @see org.eclipse.jface.preference.PreferencePage#createControl()
190 | */
191 | public void createControl(Composite parent) {
192 | // Special treatment for property pages
193 | if (isPropertyPage()) {
194 | // Cache the page id
195 | pageId = getPageId();
196 | // Create an overlay preference store and fill it with properties
197 | overlayStore =
198 | new PropertyStore(
199 | (IResource) getElement(),
200 | super.getPreferenceStore(),
201 | pageId);
202 | // Set overlay store as current preference store
203 | }
204 | super.createControl(parent);
205 | // Update enablement of all subclass controls
206 | if (isPropertyPage())
207 | setControlsEnabled();
208 | }
209 |
210 | /*
211 | * Returns in case of property pages the overlay store - otherwise the standard preference store
212 | * @see org.eclipse.jface.preference.PreferencePage#getPreferenceStore()
213 | */
214 | public IPreferenceStore getPreferenceStore() {
215 | if (isPropertyPage())
216 | return overlayStore;
217 | return super.getPreferenceStore();
218 | }
219 |
220 | /**
221 | * Enables or disables the controls of this page
222 | */
223 | private void setControlsEnabled() {
224 | boolean enabled = useProjectSettingsButton.getSelection();
225 | setControlsEnabled(enabled);
226 | }
227 |
228 | /**
229 | * Enables or disables the controls of this page
230 | * Subclasses may override.
231 | *
232 | * @param enabled - true if controls shall be enabled
233 | */
234 | protected void setControlsEnabled(boolean enabled) {
235 | setControlsEnabled(contents, enabled);
236 | }
237 |
238 | /**
239 | * Enables or disables a tree of controls starting at the specified root.
240 | * We spare tabbed notebooks and pagebooks to allow for user navigation.
241 | *
242 | * @param root - the root composite
243 | * @param enabled - true if controls shall be enabled
244 | */
245 | private void setControlsEnabled(Composite root, boolean enabled) {
246 | Control[] children = root.getChildren();
247 | for (int i = 0; i < children.length; i++) {
248 | Control child = children[i];
249 | if (!(child instanceof CTabFolder) && !(child instanceof TabFolder) && !(child instanceof PageBook))
250 | child.setEnabled(enabled);
251 | if (child instanceof Composite)
252 | setControlsEnabled((Composite) child, enabled);
253 | }
254 | }
255 |
256 | /**
257 | * We override the performOk method. In case of property pages
258 | * we save the state of the radio buttons.
259 | *
260 | * @see org.eclipse.jface.preference.IPreferencePage#performOk()
261 | */
262 | public boolean performOk() {
263 | boolean result = super.performOk();
264 | if (result && isPropertyPage()) {
265 | // Save state of radiobuttons in project properties
266 | IResource resource = (IResource) getElement();
267 | try {
268 | String value =
269 | (useProjectSettingsButton.getSelection()) ? TRUE : FALSE;
270 | resource.setPersistentProperty(
271 | new QualifiedName(pageId, USEPROJECTSETTINGS),
272 | value);
273 | } catch (CoreException e) {
274 | }
275 | }
276 | return result;
277 | }
278 |
279 | /**
280 | * We override the performDefaults method. In case of property pages we
281 | * switch back to the workspace settings and disable the page controls.
282 | *
283 | * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
284 | */
285 | protected void performDefaults() {
286 | if (isPropertyPage()) {
287 | useWorkspaceSettingsButton.setSelection(true);
288 | useProjectSettingsButton.setSelection(false);
289 | configureButton.setEnabled(true);
290 | setControlsEnabled();
291 | }
292 | super.performDefaults();
293 | }
294 |
295 | /**
296 | * Creates a new preferences page and opens it
297 | * @see com.bdaum.SpellChecker.preferences.SpellCheckerPreferencePage#configureWorkspaceSettings()
298 | */
299 | protected void configureWorkspaceSettings() {
300 | try {
301 | // create a new instance of the current class
302 | IPreferencePage page =
303 | (IPreferencePage) this.getClass().newInstance();
304 | page.setTitle(getTitle());
305 | page.setImageDescriptor(image);
306 | // and show it
307 | showPreferencePage(pageId, page);
308 | } catch (InstantiationException e) {
309 | e.printStackTrace();
310 | } catch (IllegalAccessException e) {
311 | e.printStackTrace();
312 | }
313 | }
314 |
315 | /**
316 | * Show a single preference pages
317 | * @param id - the preference page identification
318 | * @param page - the preference page
319 | */
320 | protected void showPreferencePage(String id, IPreferencePage page) {
321 | final IPreferenceNode targetNode = new PreferenceNode(id, page);
322 | PreferenceManager manager = new PreferenceManager();
323 | manager.addToRoot(targetNode);
324 | final PreferenceDialog dialog =
325 | new PreferenceDialog(getControl().getShell(), manager);
326 | BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
327 | public void run() {
328 | dialog.create();
329 | dialog.setMessage(targetNode.getLabelText());
330 | dialog.open();
331 | }
332 | });
333 | }
334 |
335 | }
336 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/bdaum/overlayPages/PropertyStore.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2003 Berthold Daum.
3 | * All rights reserved. This program and the accompanying materials
4 | * are made available under the terms of the Common Public License v1.0
5 | * which accompanies this distribution, and is available at
6 | * http://www.eclipse.org/legal/cpl-v10.html
7 | *
8 | * Contributors:
9 | * Berthold Daum
10 | *******************************************************************************/
11 |
12 | package com.bdaum.overlayPages;
13 |
14 | import java.io.IOException;
15 | import java.io.OutputStream;
16 |
17 | import org.eclipse.core.resources.IResource;
18 | import org.eclipse.core.runtime.CoreException;
19 | import org.eclipse.core.runtime.QualifiedName;
20 | import org.eclipse.jface.preference.IPreferenceStore;
21 | import org.eclipse.jface.preference.PreferenceStore;
22 |
23 | /**
24 | * @author Berthold Daum
25 | *
26 | */
27 | public class PropertyStore extends PreferenceStore {
28 |
29 | private IResource resource;
30 | private IPreferenceStore workbenchStore;
31 | private String pageId;
32 | private boolean inserting = false;
33 |
34 | public PropertyStore(
35 | IResource resource,
36 | IPreferenceStore workbenchStore,
37 | String pageId) {
38 | this.resource = resource;
39 | this.workbenchStore = workbenchStore;
40 | this.pageId = pageId;
41 | }
42 |
43 | /*** Write modified values back to properties ***/
44 |
45 | /* (non-Javadoc)
46 | * @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
47 | */
48 | public void save() throws IOException {
49 | writeProperties();
50 | }
51 |
52 | /* (non-Javadoc)
53 | * @see org.eclipse.jface.preference.PreferenceStore#save(java.io.OutputStream, java.lang.String)
54 | */
55 | public void save(OutputStream out, String header) throws IOException {
56 | writeProperties();
57 | }
58 |
59 | /**
60 | * Writes modified preferences into resource properties.
61 | */
62 | private void writeProperties() throws IOException {
63 | String[] preferences = super.preferenceNames();
64 | for (int i = 0; i < preferences.length; i++) {
65 | String name = preferences[i];
66 | try {
67 | setProperty(name, getString(name));
68 | } catch (CoreException e) {
69 | throw new IOException(Messages.getString("PropertyStore.Cannot_write_resource_property") + name); //$NON-NLS-1$
70 | }
71 | }
72 | }
73 |
74 | /**
75 | * Convenience method to set a property
76 | * @param name - the preference name
77 | * @param value - the property value or null to delete the property
78 | * @throws CoreException
79 | */
80 | private void setProperty(String name, String value) throws CoreException {
81 | resource.setPersistentProperty(new QualifiedName(pageId, name), value);
82 | }
83 |
84 | /*** Get default values (Delegate to workbench store) ***/
85 |
86 | /* (non-Javadoc)
87 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
88 | */
89 | public boolean getDefaultBoolean(String name) {
90 | return workbenchStore.getDefaultBoolean(name);
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
95 | */
96 | public double getDefaultDouble(String name) {
97 | return workbenchStore.getDefaultDouble(name);
98 | }
99 |
100 | /* (non-Javadoc)
101 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
102 | */
103 | public float getDefaultFloat(String name) {
104 | return workbenchStore.getDefaultFloat(name);
105 | }
106 |
107 | /* (non-Javadoc)
108 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
109 | */
110 | public int getDefaultInt(String name) {
111 | return workbenchStore.getDefaultInt(name);
112 | }
113 |
114 | /* (non-Javadoc)
115 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
116 | */
117 | public long getDefaultLong(String name) {
118 | return workbenchStore.getDefaultLong(name);
119 | }
120 |
121 | /* (non-Javadoc)
122 | * @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
123 | */
124 | public String getDefaultString(String name) {
125 | return workbenchStore.getDefaultString(name);
126 | }
127 |
128 | /*** Get property values ***/
129 |
130 | /* (non-Javadoc)
131 | * @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
132 | */
133 | public boolean getBoolean(String name) {
134 | insertValue(name);
135 | return super.getBoolean(name);
136 | }
137 |
138 | /* (non-Javadoc)
139 | * @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
140 | */
141 | public double getDouble(String name) {
142 | insertValue(name);
143 | return super.getDouble(name);
144 | }
145 |
146 | /* (non-Javadoc)
147 | * @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
148 | */
149 | public float getFloat(String name) {
150 | insertValue(name);
151 | return super.getFloat(name);
152 | }
153 |
154 | /* (non-Javadoc)
155 | * @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
156 | */
157 | public int getInt(String name) {
158 | insertValue(name);
159 | return super.getInt(name);
160 | }
161 |
162 | /* (non-Javadoc)
163 | * @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
164 | */
165 | public long getLong(String name) {
166 | insertValue(name);
167 | return super.getLong(name);
168 | }
169 |
170 | /* (non-Javadoc)
171 | * @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
172 | */
173 | public String getString(String name) {
174 | insertValue(name);
175 | return super.getString(name);
176 | }
177 |
178 | /**
179 | * @param name
180 | */
181 | private synchronized void insertValue(String name) {
182 | if (inserting)
183 | return;
184 | if (super.contains(name))
185 | return;
186 | inserting = true;
187 | String prop = null;
188 | try {
189 | prop = getProperty(name);
190 | } catch (CoreException e) {
191 | }
192 | if (prop == null)
193 | prop = workbenchStore.getString(name);
194 | if (prop != null)
195 | setValue(name, prop);
196 | inserting = false;
197 | }
198 |
199 | /**
200 | * Convenience method to fetch a property
201 | * @param name - the preference name
202 | * @return - the property value
203 | * @throws CoreException
204 | */
205 | private String getProperty(String name) throws CoreException {
206 | return resource.getPersistentProperty(new QualifiedName(pageId, name));
207 | }
208 |
209 | /*** Misc ***/
210 |
211 | /* (non-Javadoc)
212 | * @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
213 | */
214 | public boolean contains(String name) {
215 | return workbenchStore.contains(name);
216 | }
217 |
218 | /* (non-Javadoc)
219 | * @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
220 | */
221 | public void setToDefault(String name) {
222 | setValue(name, getDefaultString(name));
223 | }
224 |
225 | /* (non-Javadoc)
226 | * @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
227 | */
228 | public boolean isDefault(String name) {
229 | String defaultValue = getDefaultString(name);
230 | if (defaultValue == null) return false;
231 | return defaultValue.equals(getString(name));
232 | }
233 |
234 | }
235 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/restphone/androidproguardscala/preferences/PreferenceConstants.java:
--------------------------------------------------------------------------------
1 | //package com.restphone.androidproguardscala.preferences;
2 | //
3 | ///**
4 | // * Constant definitions for plug-in preferences
5 | // */
6 | //public class PreferenceConstants {
7 | //
8 | // public static final String P_PATH = "pathPreference";
9 | //
10 | // public static final String P_BOOLEAN = "booleanPreference";
11 | //
12 | // public static final String P_CHOICE = "choicePreference";
13 | //
14 | // public static final String P_STRING = "stringPreference";
15 | //
16 | //}
17 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/java/com/restphone/androidproguardscala/preferences/PreferenceInitializer.java:
--------------------------------------------------------------------------------
1 | //package com.restphone.androidproguardscala.preferences;
2 | //
3 | //import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
4 | //import org.eclipse.jface.preference.IPreferenceStore;
5 | //
6 | //import pluginClass;
7 | //
8 | ///**
9 | // * Class used to initialize default preference values.
10 | // */
11 | //public class PreferenceInitializer extends AbstractPreferenceInitializer {
12 | //
13 | // /*
14 | // * (non-Javadoc)
15 | // *
16 | // * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
17 | // */
18 | // public void initializeDefaultPreferences() {
19 | // IPreferenceStore store = activator.getDefault().getPreferenceStore();
20 | // store.setDefault(PreferenceConstants.P_BOOLEAN, true);
21 | // store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
22 | // store.setDefault(PreferenceConstants.P_STRING,
23 | // "Default value");
24 | // }
25 | //
26 | //}
27 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/resources/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/banshee/AndroidProguardScala/854e5f89e546c4e211ad02676ad601d1e00c0789/com.restphone.androidproguardscala.plugin/src/main/resources/.keep
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/Activator.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import org.eclipse.jface.preference.IPreferenceStore
4 |
5 | class Activator extends org.eclipse.ui.plugin.AbstractUIPlugin {
6 | override def getPreferenceStore: IPreferenceStore = super.getPreferenceStore
7 | }
8 |
9 | object Activator {
10 | lazy val defaultActivator = new Activator
11 | }
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/AndroidProguardScalaBuilder.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import java.io.File
4 | import java.io.ObjectStreamException
5 | import java.net.URL
6 |
7 | import scala.Array.canBuildFrom
8 |
9 | import org.eclipse.core.resources.IProject
10 | import org.eclipse.core.resources.IResource
11 | import org.eclipse.core.resources.IResourceDelta
12 | import org.eclipse.core.resources.IWorkspaceRoot
13 | import org.eclipse.core.resources.IncrementalProjectBuilder
14 | import org.eclipse.core.resources.ResourcesPlugin
15 | import org.eclipse.core.runtime.FileLocator
16 | import org.eclipse.core.runtime.IPath
17 | import org.eclipse.core.runtime.IProgressMonitor
18 | import org.eclipse.core.runtime.IStatus
19 | import org.eclipse.core.runtime.Path
20 | import org.eclipse.core.runtime.Platform
21 | import org.eclipse.core.runtime.Status
22 | import org.eclipse.jdt.core.IClasspathEntry
23 | import org.eclipse.jdt.core.JavaCore
24 |
25 | import com.google.common.io.Files
26 | import com.restphone.jartender.BuiltLibrary
27 | import com.restphone.jartender.CacheSystem
28 | import com.restphone.jartender.ExistingLibrary
29 | import com.restphone.jartender.FileFailureValidation.FailureValidation
30 | import com.restphone.jartender.FileFailureValidation.FailureWithoutException
31 | import com.restphone.jartender.FileFailureValidation.convertExceptionToValidation
32 | import com.restphone.jartender.FileFailureValidation.stdExceptions
33 | import com.restphone.jartender.FileFailureValidation.validatedFile
34 | import com.restphone.jartender.JartenderCacheParameters
35 | import com.restphone.jartender.RichFile
36 | import com.restphone.jartender.SerializableUtilities
37 |
38 | import scalaz.Scalaz._
39 |
40 | class AndroidProguardScalaBuilder extends IncrementalProjectBuilder {
41 | import RichPath._
42 |
43 | def buildPatternMatch[ T ]( fn: T => Boolean ) = new Object {
44 | def unapply[ U <% T ]( x: U ) = if ( fn( x ) ) some( x ) else none
45 | }
46 |
47 | override def build( kind: Int, args: java.util.Map[ String, String ], monitor: IProgressMonitor ): Array[ IProject ] = {
48 | val buildRequired = {
49 | val pathIsBuildArtifact = buildPatternMatch[ IPath ]( _.lastSegment.startsWith( "proguard_" ) )
50 | def buildArtifactsRequireRebuild( xs: List[ IPath ] ): Boolean = {
51 | xs match {
52 | case pathIsBuildArtifact( h ) :: Nil => false
53 | case pathIsBuildArtifact( h ) :: t => buildArtifactsRequireRebuild( t )
54 | case _ => true
55 | }
56 | }
57 |
58 | val affected_paths: List[ IPath ] = getDelta( getProject ) match {
59 | case x: IResourceDelta => ( x.getAffectedChildren map { _.getFullPath } ).toList
60 | case null => List.empty
61 | }
62 |
63 | buildArtifactsRequireRebuild( affected_paths )
64 | }
65 |
66 | if ( buildRequired ) {
67 | val proguardDefaults = {
68 | val url = new URL( "platform:/plugin/com.restphone.androidproguardscala/proguard_cache_conf/proguard_defaults.conf" );
69 | val inputStream = url.openConnection().getInputStream();
70 | val s = scala.io.Source.fromInputStream( inputStream )
71 | val result = s.getLines.mkString( "\n" ) + "\n\n# AndroidProguardScala version: " + platformBundle.getVersion.toString + "\n"
72 | s.close()
73 | result
74 | }
75 |
76 | Seq( cacheDir, confDir, libDirectory ) foreach RichPath.ensureDirExists
77 |
78 | val projectdata = new JavaProjectData( javaProject )
79 |
80 | val proguardProcessedConfFile = confDir / "proguard_postprocessed.conf"
81 | val proguardAdditionsFile = confDir / "proguard_additions.conf"
82 | val cachedJar = cacheDir / "scala-library.CKSUM.jar"
83 | val outputJar = rootDirectoryOfProject / "libs" / minifiedScalaLibraryName
84 | val existingOutputFolders = projectdata.outputDirectories
85 |
86 | implicit def convertIPathToString( p: IPath ): String = p.toString
87 |
88 | val jartenderParams = JartenderCacheParameters(
89 | cacheDir = cacheDir,
90 | classFiles = existingOutputFolders.toList,
91 | inputJars = projectdata.inputJars map { _.fullPath },
92 | libraryJars = projectdata.libraryJars map { _.fullPath } )
93 |
94 | val proguardCacheParameters = new ProguardCacheParameters(
95 | jartenderConfiguration = jartenderParams,
96 | proguardAdditionsFile = proguardAdditionsFile,
97 | proguardDefaults = proguardDefaults,
98 | proguardProcessedConfFile = proguardProcessedConfFile )
99 |
100 | val cacheFile = new File( cacheDir / "cache.data" )
101 |
102 | val result = for {
103 | cacheSystem <- readCacheSystemFromFile( cacheFile ) ||| ( new CacheSystem ).success
104 | runner = new ProguardRunner( cacheSystem )
105 | shrinker = runner.createShrinker( proguardCacheParameters )
106 | cacheEntry <- cacheSystem.execute( shrinker )
107 | outputPath = cacheEntry.c.jarfilepath
108 | outputJarFile <- cacheSystem.installOutputJar( new File( outputPath ), new File( outputJar.toString ) )
109 | } yield {
110 | val bytesForCache = SerializableUtilities.convertToByteArray( cacheSystem )
111 | Files.write( bytesForCache, cacheFile )
112 | cacheEntry match {
113 | case _: BuiltLibrary =>
114 | Iterable( outputJar, confDir, cacheDir ) foreach tellEclipsePathNeedsToBeRefreshed
115 | case _: ExistingLibrary =>
116 | }
117 | cacheEntry
118 | }
119 |
120 | logMsg( result.fold( fail = x => x.toString, succ = x => f"${x.c.jarfilepath} Successful cache run (${x.getClass.toString})" ) )
121 |
122 | Iterable( outputJar, confDir, cacheDir ) foreach tellEclipsePathNeedsToBeRefreshed
123 | }
124 |
125 | Array.empty
126 | }
127 |
128 | override def clean( monitor: IProgressMonitor ) = {
129 | ( new File( cacheDir.toString ) ).listFiles map { f => NotNull.ignoreExceptions { f.delete } }
130 | }
131 |
132 | def readCacheSystemFromFile( f: File ) = {
133 | val deserializeExceptions = classOf[ ClassNotFoundException ] :: classOf[ ObjectStreamException ] :: classOf[ ClassCastException ] :: stdExceptions
134 | implicit val safeDeserialize = convertExceptionToValidation( deserializeExceptions )_
135 |
136 | def bytesToCacheSystem( bytes: Array[ Byte ] ): FailureValidation[ CacheSystem ] =
137 | for {
138 | x <- safeDeserialize( "deserialize CacheSystem", none ) {
139 | val obj: Option[ CacheSystem ] = SerializableUtilities.byteArrayToObject( bytes )
140 | obj match {
141 | case Some( v ) => v.success
142 | case None => FailureWithoutException( "failed to get a cache system object from bytes" ).failureNel
143 | }
144 | }
145 | } yield x
146 |
147 | for {
148 | existingFile <- validatedFile( f, "reading cache file" )
149 | bytesFromCacheFile = Files.toByteArray( existingFile )
150 | result <- bytesToCacheSystem( bytesFromCacheFile )
151 | } yield result
152 | }
153 |
154 | def tellEclipsePathNeedsToBeRefreshed( p: IPath ) = {
155 | getProject.getFile( p ).refreshLocal( IResource.DEPTH_INFINITE, null )
156 | }
157 |
158 | def rootDirectoryOfProject = convertResourceToFilesystemLocation( getProject )
159 | def cacheDir = rootDirectoryOfProject / "proguard_cache"
160 | def confDir = rootDirectoryOfProject / "proguard_cache_conf"
161 | def libDirectory = rootDirectoryOfProject / "libs"
162 | // def scalaProject = scala.tools.eclipse.ScalaProject(getProject)
163 |
164 | def isCpeLibrary( x: IClasspathEntry ) = x.getEntryKind == IClasspathEntry.CPE_LIBRARY
165 | def isMinifiedLibraryName( s: String ) = s == minifiedScalaLibraryName
166 |
167 | def convertResourceToFilesystemLocation( resource: IResource ) = new Path( resource.getLocationURI.getPath )
168 |
169 | def logger() = new ProvidesLogging {
170 | def logMsg( msg: String ) = AndroidProguardScalaBuilder.this.logMsg( msg )
171 | def logError( msg: String ) = AndroidProguardScalaBuilder.this.logMsg( msg, IStatus.ERROR )
172 | }
173 |
174 | private val lastSegmentIsString = ( s: String ) => ( p: IPath ) => p.lastSegment.equals( s )
175 | val lastSegmentIsScalaLibrary = lastSegmentIsString( "scala-library.jar" )
176 | val lastSegmentIsAndroidLibrary = lastSegmentIsString( "android.jar" )
177 | val fileExists = ( p: IPath ) => p.toFile.exists
178 |
179 | lazy val javaProject = JavaCore.create( getProject )
180 |
181 | def objToString[ T ]( x: T ) = x.toString
182 |
183 | def getWorkspaceRoot: IWorkspaceRoot = ResourcesPlugin.getWorkspace.getRoot
184 | def rootDirectoryOfWorkspace: IPath = getWorkspaceRoot.getLocation
185 |
186 | val platformBundle = Platform.getBundle( "com.restphone.androidproguardscala" );
187 |
188 | // This seems like a hack, but it's apparently the right thing to do to find the plugin
189 | // directory.
190 | def pluginDirectory =
191 | for {
192 | u <- NotNull( FileLocator.find( platformBundle, new Path( "/" ), null ), "cannot find directory for bundle" )
193 | filenameUrl <- NotNull( FileLocator.resolve( u ), "FileLocator.resolve must not return null" )
194 | f = new Path( filenameUrl.getFile )
195 | } yield f
196 |
197 | def logMsg( msg: String, status: Integer = IStatus.INFO ) = {
198 | val log = Platform.getLog( platformBundle );
199 | val s = new Status( status, pluginId, msg )
200 | log.log( s )
201 | }
202 |
203 | val pluginId = "com.restphone.androidproguardscala"
204 |
205 | def minifiedScalaLibraryName = "scala_library.min.jar"
206 | }
207 |
208 | object AndroidProguardScalaBuilder {
209 | val BUILDER_ID = "com.restphone.androidproguardscala.Builder";
210 | }
211 |
212 | class RichPath( p: IPath ) {
213 | def /( that: String ) = p.append( that )
214 | }
215 |
216 | object RichPath {
217 | implicit def toRichPath( p: IPath ): RichPath = new RichPath( p )
218 | def ensureDirExists( p: IPath ) = RichFile.ensureDirExists( p.toFile )
219 | }
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/ApsNature.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import scala.beans.BeanProperty
4 |
5 | import org.eclipse.core.resources.ICommand
6 | import org.eclipse.core.resources.IProject
7 | import org.eclipse.core.resources.IProjectNature
8 |
9 | class AndroidProguardScalaNature extends IProjectNature {
10 | @BeanProperty var project: IProject = null
11 |
12 | def existingCommands = project.getDescription.getBuildSpec
13 | def builderNameMatches( x: ICommand ) = x.getBuilderName == AndroidProguardScalaBuilder.BUILDER_ID
14 | def existingBuilder = existingCommands find builderNameMatches
15 |
16 | override def configure =
17 | existingBuilder getOrElse {
18 | val description = project.getDescription
19 | val command = description.newCommand
20 | command.setBuilderName( AndroidProguardScalaBuilder.BUILDER_ID )
21 | val builders = existingCommands ++ Array( command )
22 | description.setBuildSpec( builders )
23 | project.setDescription( description, null )
24 | }
25 |
26 | override def deconfigure = {
27 | existingBuilder foreach {
28 | _ =>
29 | val otherBuilders = existingCommands filterNot builderNameMatches
30 | val description = project.getDescription
31 | description.setBuildSpec( otherBuilders )
32 | project.setDescription( description, null )
33 | }
34 | }
35 | }
36 |
37 | object AndroidProguardScalaNature {
38 | val NATURE_ID = "com.restphone.androidproguardscala.Nature"
39 | }
40 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/ClasspathEntryData.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import java.io.File
4 |
5 | import com.restphone.jartender.RichFile
6 |
7 | import scalaz.Scalaz._
8 |
9 | case class ClasspathEntryData( fieldName: String, fullPath: String )
10 |
11 | object ClasspathEntryData {
12 | def convertPathToPreferenceName( pathAsString: String ) = {
13 | val files = RichFile.splitFile( new File( pathAsString ) )
14 | val elementNames = files map {_.getName}
15 | elementNames.reverse match {
16 | case a :: b :: t => some( f"jarfile_${a}_${b}" )
17 | case a :: t => some( f"jarfile_x_${a}" )
18 | case _ => None
19 | }
20 | }
21 | }
22 |
23 | sealed abstract class ClasspathEntryType {
24 | val asString: String
25 | }
26 | case object InputJar extends ClasspathEntryType {
27 | val asString = ClasspathEntryType.INPUTJAR
28 | }
29 | case object LibraryJar extends ClasspathEntryType {
30 | val asString = ClasspathEntryType.LIBRARYJAR
31 | }
32 | case object IgnoredJar extends ClasspathEntryType {
33 | val asString = ClasspathEntryType.IGNORE
34 | }
35 |
36 | object ClasspathEntryType {
37 | def convertStringToClasspathEntryType( s: String ) = s match {
38 | case INPUTJAR => some( InputJar )
39 | case LIBRARYJAR => some( LibraryJar )
40 | case IGNORE => some( IgnoredJar )
41 | case _ => none[ClasspathEntryType]
42 | }
43 |
44 | val INPUTJAR = "inputjar"
45 | val LIBRARYJAR = "libraryjar"
46 | val IGNORE = "ignore"
47 | }
48 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/JavaProjectData.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import org.eclipse.jdt.core.IJavaProject
4 | import org.eclipse.jdt.core.IPackageFragmentRoot
5 | import org.eclipse.ui.preferences.ScopedPreferenceStore
6 | import org.eclipse.core.runtime.preferences.IScopeContext
7 | import org.eclipse.core.resources.ProjectScope
8 | import org.eclipse.core.runtime.IPath
9 | import org.eclipse.core.resources.ResourcesPlugin
10 | import org.eclipse.jdt.core.IClasspathEntry
11 | import scala.PartialFunction._
12 | import scalaz._
13 | import Scalaz._
14 | import org.eclipse.core.internal.runtime.Log
15 | import org.eclipse.jdt.internal.core.ClasspathEntry
16 |
17 | class JavaProjectData( project: IJavaProject ) {
18 | def getProject = project.getProject
19 |
20 | def classpathEntries: Array[ ClasspathEntryData ] =
21 | classpathData map { _.data }
22 |
23 | case class ClasspathData( entry: IClasspathEntry, data: ClasspathEntryData )
24 |
25 | private def classpathData =
26 | for {
27 | classpathentry <- project.getResolvedClasspath( true ) if ( ( classpathentry.getContentKind ^ IPackageFragmentRoot.K_SOURCE ) != 0 )
28 | prefname <- ClasspathEntryData.convertPathToPreferenceName( classpathentry.getPath.toOSString )
29 | } yield ClasspathData( classpathentry, ClasspathEntryData( prefname, classpathentry.getPath.toOSString ) )
30 |
31 | def outputDirectories = {
32 | val cpes = project.getResolvedClasspath( true ) filter { _.getEntryKind == IClasspathEntry.CPE_SOURCE } filter { _.getContentKind == IPackageFragmentRoot.K_SOURCE }
33 | val specificOutputLocations = cpes flatMap { c => Option( c.getOutputLocation ) }
34 | val optionalDirectories = ( project.getOutputLocation :: specificOutputLocations.toList ).toSet map convertPathToFilesystemPath
35 | optionalDirectories.flatten
36 | }
37 |
38 | val preferences = {
39 | val projectScope: IScopeContext = new ProjectScope( getProject )
40 | val store = new ScopedPreferenceStore( projectScope, "com.restphone.androidproguardscala" );
41 | for {
42 | ClasspathData( entry, data ) <- classpathData
43 | defaultValue = defaultValueForClasspathEntry( entry.getPath )
44 | } yield {
45 | store.setDefault( data.fieldName, defaultValue.asString )
46 | }
47 | store
48 | }
49 |
50 | def defaultValueForClasspathEntry( classpathEntryPath: IPath ): ClasspathEntryType = {
51 | val MatchesAndroidSdk = ".*android-sdk.*".r
52 | val AndroidSupport = """android-support-v\d+.jar""".r
53 | val Scalaz = """scalaz-.*jar""".r
54 | val Akka = """akka-.*jar""".r
55 | val ( a, b ) = ( classpathEntryPath.toOSString, classpathEntryPath.lastSegment )
56 | val result = ( a, b ) match {
57 | case ( _, ( "scala-library.jar" | "scala-actors.jar" | "scala-reflect.jar" ) ) => InputJar
58 | case ( _, Scalaz() ) => InputJar
59 | case ( _, Akka() ) => InputJar
60 | case ( _, "android.jar" ) => LibraryJar
61 | case ( _, MatchesAndroidSdk() ) => LibraryJar
62 | case ( _, AndroidSupport() ) => LibraryJar
63 | case _ => IgnoredJar
64 | }
65 | result
66 | }
67 |
68 | def inputJars = jarsOfType( InputJar )
69 | def libraryJars = jarsOfType( LibraryJar )
70 |
71 | private def jarsOfType( t: ClasspathEntryType ) = {
72 | classpathEntries filter { stateForClasspathEntryData( _ ) == t } toList
73 | }
74 |
75 | private def stateForClasspathEntryData( c: ClasspathEntryData ): ClasspathEntryType = {
76 | val pref = preferences.getString( c.fieldName )
77 | ClasspathEntryType.convertStringToClasspathEntryType( pref ) getOrElse ( IgnoredJar )
78 | }
79 |
80 | def convertPathToFilesystemPath( p: IPath ) = {
81 | for {
82 | root <- Option( ResourcesPlugin.getWorkspace().getRoot() )
83 | member <- Option( root.findMember( p ) )
84 | rawLocation <- Option( member.getRawLocation )
85 | osString <- Option( rawLocation.toOSString )
86 | } yield osString
87 | }
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/ProjectUtilities.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import org.eclipse.core.resources.IProject
4 | import java.util.ArrayList
5 | import com.google.common.collect.Lists
6 | import org.eclipse.core.runtime.IPath
7 | import scala.collection.mutable
8 | import org.eclipse.jdt.core.IJavaProject
9 | import org.eclipse.jdt.core.IClasspathEntry
10 |
11 | object ProjectUtilities {
12 | // def outputFolders(p: IProject): ArrayList[IPath] = {
13 | // val items = scala.tools.eclipse.ScalaProject(p).sourceOutputFolders.map { case (src, dest) => dest.getLocation }
14 | // val jarl = new ArrayList[IPath]();
15 | // items.foreach { x => jarl.add(x) }
16 | // return jarl;
17 | // }
18 | //
19 | def outputFolders(javaProject:IJavaProject): Seq[IPath] = {
20 | val outputs = new mutable.ArrayBuffer[IPath](10)
21 | for (cpe <- javaProject.getResolvedClasspath(true) if cpe.getEntryKind == IClasspathEntry.CPE_SOURCE) {
22 | val cpeOutput = cpe.getOutputLocation
23 | val output = if (cpeOutput == null) javaProject.getOutputLocation else cpeOutput
24 | outputs += output
25 | }
26 | outputs.toSeq
27 | }
28 | }
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/ProvidesLogging.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | trait ProvidesLogging {
4 | def logMsg(msg: String)
5 | def logError(msg: String)
6 | }
7 |
8 | object ProvidesLogging {
9 | val NullLogger = new ProvidesLogging {
10 | def logMsg(msg: String) {}
11 | def logError(msg: String) {}
12 | }
13 | }
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/ToggleNature.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import scala.Array.canBuildFrom
4 | import scala.collection.JavaConversions.asScalaIterator
5 |
6 | import org.eclipse.core.resources.IProject
7 | import org.eclipse.core.runtime.IAdaptable
8 | import org.eclipse.jdt.core.JavaCore
9 | import org.eclipse.jface.action.IAction
10 | import org.eclipse.jface.viewers.ISelection
11 | import org.eclipse.jface.viewers.IStructuredSelection
12 | import org.eclipse.ui.IObjectActionDelegate
13 | import org.eclipse.ui.IWorkbenchPart
14 | import org.eclipse.ui.commands.IElementUpdater
15 | import org.eclipse.ui.menus.UIElement
16 |
17 | import scalaz.Scalaz._
18 |
19 | class ToggleNatureAction extends IObjectActionDelegate with IElementUpdater {
20 | var selection: Option[ISelection] = None
21 |
22 | override def run( action: IAction ): Unit = {
23 | selection collect {
24 | case s: IStructuredSelection =>
25 | s.iterator collect {
26 | case p: IProject => p
27 | case a: IAdaptable => a.getAdapter( classOf[IProject] ).asInstanceOf[IProject]
28 | } foreach { toggleNature( _ ) }
29 | }
30 | }
31 |
32 | def selectionChanged( action: IAction, s: ISelection ) = {
33 | selection = some( s )
34 | }
35 |
36 | def toggleNature( project: IProject ) = {
37 | if ( project.isOpen ) {
38 | val description = project.getDescription
39 | val natures = description.getNatureIds
40 | val newNatures = natures find isApsNatureName match {
41 | case Some( _ ) => natures filterNot isApsNatureName
42 | case None => natures ++ Array( AndroidProguardScalaNature.NATURE_ID )
43 | }
44 | description.setNatureIds( newNatures )
45 | project.setDescription( description, null )
46 | moveScalaClasspathContainersEarlyInTheClasspath( project )
47 | project.touch( null )
48 | }
49 | }
50 |
51 | def moveScalaClasspathContainersEarlyInTheClasspath( project: IProject ): Unit = {
52 | // Move the scala classpath containers to be early in the classpath. They have to be before the Android
53 | // classpath container or the scala presentation compiler crashes.
54 |
55 | // Yes, this is an ugly hack.
56 |
57 | val ( scalaCpes, nonScalaCpes ) = javaProject( project ).getRawClasspath partition { cpe => cpe.getPath.toString.contains( "SCALA" ) }
58 | val newClasspath = scalaCpes ++ nonScalaCpes
59 | javaProject( project ).setRawClasspath( newClasspath, null )
60 | }
61 |
62 | def javaProject( p: IProject ) = JavaCore.create( p )
63 |
64 | def isApsNatureName( s: String ) = s == AndroidProguardScalaNature.NATURE_ID
65 |
66 | // updateElement and setActivePart are required by the interface we need to implement,
67 | // but I don't do anything useful with them
68 | override def updateElement( arg0: UIElement, arg1: java.util.Map[_, _] ) = {}
69 | def setActivePart( a: IAction, target: IWorkbenchPart ) = {}
70 | }
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/Utilities.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala
2 |
3 | import scala.util.control.Exception._
4 | import java.io.File
5 |
6 | object NotNull {
7 | val catchNull = catching(classOf[NullPointerException])
8 |
9 | val ignoreExceptions = catchNull
10 |
11 | def apply[T](x: => T, msg: String = "must not be null"): Option[T] = {
12 | catchNull.opt(x) match {
13 | case None | Some(null) => throw new RuntimeException(msg)
14 | case x => x
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/com.restphone.androidproguardscala.plugin/src/main/scala/com/restphone/androidproguardscala/preferences/ClasspathPreferences.scala:
--------------------------------------------------------------------------------
1 | package com.restphone.androidproguardscala.preferences;
2 |
3 | import java.io.File
4 | import org.eclipse.core.resources.IProject
5 | import org.eclipse.core.runtime.IAdaptable
6 | import org.eclipse.jdt.core.JavaCore
7 | import org.eclipse.jface.preference.FieldEditorPreferencePage
8 | import org.eclipse.jface.preference.RadioGroupFieldEditor
9 | import org.eclipse.swt.widgets.Composite
10 | import org.eclipse.ui.IWorkbenchPropertyPage
11 | import com.restphone.androidproguardscala.ClasspathEntryData
12 | import com.restphone.androidproguardscala.ClasspathEntryType.IGNORE
13 | import com.restphone.androidproguardscala.ClasspathEntryType.INPUTJAR
14 | import com.restphone.androidproguardscala.ClasspathEntryType.LIBRARYJAR
15 | import com.restphone.androidproguardscala.IgnoredJar
16 | import com.restphone.androidproguardscala.InputJar
17 | import com.restphone.androidproguardscala.JavaProjectData
18 | import com.restphone.jartender.RichFile
19 | import com.restphone.androidproguardscala.ClasspathEntryType
20 | import com.restphone.androidproguardscala.LibraryJar
21 | import org.eclipse.core.runtime.IPath
22 | import org.eclipse.core.runtime.Path
23 |
24 | /**
25 | * This class represents a preference page that
26 | * is contributed to the Preferences dialog. By
27 | * subclassing FieldEditorPreferencePage, we
28 | * can use the field support built into JFace that allows
29 | * us to create a page that is small and knows how to
30 | * save, restore and apply itself.
31 | *