summaryrefslogtreecommitdiffstats
path: root/jack-server
diff options
context:
space:
mode:
authorJean-Marie Henaff <jmhenaff@google.com>2015-03-27 18:41:36 +0100
committerJean-Marie Henaff <jmhenaff@google.com>2015-03-30 15:36:18 +0200
commit00d8ad6749739964c35f37740fc87bb05afc47ae (patch)
tree8cbbed83972f90ed17ed10df096dd38d01759914 /jack-server
parent091516b153ad020a1b92afa33ae417598e78c3e6 (diff)
downloadtoolchain_jack-00d8ad6749739964c35f37740fc87bb05afc47ae.tar.gz
toolchain_jack-00d8ad6749739964c35f37740fc87bb05afc47ae.tar.bz2
toolchain_jack-00d8ad6749739964c35f37740fc87bb05afc47ae.zip
Split Jack server as a separate project
Change-Id: I1b593fda9ba89298d8729684778f8992689d8b32
Diffstat (limited to 'jack-server')
-rw-r--r--jack-server/.checkstyle10
-rw-r--r--jack-server/.classpath17
-rw-r--r--jack-server/.project29
-rw-r--r--jack-server/.settings/edu.umd.cs.findbugs.core.prefs144
-rw-r--r--jack-server/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jack-server/.settings/org.eclipse.jdt.apt.core.prefs4
-rw-r--r--jack-server/.settings/org.eclipse.jdt.core.prefs427
-rw-r--r--jack-server/.settings/org.eclipse.jdt.ui.prefs63
-rw-r--r--jack-server/.settings/org.eclipse.ltk.core.refactoring.prefs2
-rw-r--r--jack-server/Android.mk41
-rw-r--r--jack-server/MODULE_LICENSE_APACHE20
-rw-r--r--jack-server/NOTICE176
-rw-r--r--jack-server/jackstyle.xml314
-rw-r--r--jack-server/src/com/android/jack/server/JackSimpleServer.java704
-rw-r--r--jack-server/src/com/android/jack/server/Server.java438
-rw-r--r--jack-server/src/com/android/jack/server/ServerExitStatus.java30
-rw-r--r--jack-server/src/com/android/jack/server/ServerTask.java32
-rw-r--r--jack-server/src/com/android/jack/server/ServerTaskInsideVm.java95
-rw-r--r--jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java152
19 files changed, 2680 insertions, 0 deletions
diff --git a/jack-server/.checkstyle b/jack-server/.checkstyle
new file mode 100644
index 00000000..6928075a
--- /dev/null
+++ b/jack-server/.checkstyle
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="false" sync-formatter="false">
+ <local-check-config name="Jack Checkstyle" location="jackstyle.xml" type="project" description="">
+ <additional-data name="protect-config-file" value="true"/>
+ </local-check-config>
+ <fileset name="Java Source Files" enabled="true" check-config-name="Jack Checkstyle" local="true">
+ <file-match-pattern match-pattern="^src.*\.java$" include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/jack-server/.classpath b/jack-server/.classpath
new file mode 100644
index 00000000..d4363286
--- /dev/null
+++ b/jack-server/.classpath
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/Jack"/>
+ <classpathentry kind="src" path=".apt_generated">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib" path="libs/args4j-lib.jar"/>
+ <classpathentry kind="lib" path="libs/jsr305-lib.jar"/>
+ <classpathentry kind="lib" path="libs/simple-lib.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/Scheduler"/>
+ <classpathentry kind="lib" path="libs/guava-lib.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jack-server/.project b/jack-server/.project
new file mode 100644
index 00000000..ab2bc24b
--- /dev/null
+++ b/jack-server/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jack-server</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+ </natures>
+</projectDescription>
diff --git a/jack-server/.settings/edu.umd.cs.findbugs.core.prefs b/jack-server/.settings/edu.umd.cs.findbugs.core.prefs
new file mode 100644
index 00000000..6ea6b35e
--- /dev/null
+++ b/jack-server/.settings/edu.umd.cs.findbugs.core.prefs
@@ -0,0 +1,144 @@
+#FindBugs User Preferences
+#Fri Mar 27 18:42:38 CET 2015
+cloud_id=edu.umd.cs.findbugs.cloud.doNothingCloud
+detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
+detectorAtomicityProblem=AtomicityProblem|true
+detectorBadAppletConstructor=BadAppletConstructor|false
+detectorBadResultSetAccess=BadResultSetAccess|true
+detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
+detectorBadUseOfReturnValue=BadUseOfReturnValue|true
+detectorBadlyOverriddenAdapter=BadlyOverriddenAdapter|true
+detectorBooleanReturnNull=BooleanReturnNull|true
+detectorCallToUnsupportedMethod=CallToUnsupportedMethod|false
+detectorCheckExpectedWarnings=CheckExpectedWarnings|false
+detectorCheckImmutableAnnotation=CheckImmutableAnnotation|true
+detectorCheckRelaxingNullnessAnnotation=CheckRelaxingNullnessAnnotation|true
+detectorCheckTypeQualifiers=CheckTypeQualifiers|true
+detectorCloneIdiom=CloneIdiom|true
+detectorComparatorIdiom=ComparatorIdiom|true
+detectorConfusedInheritance=ConfusedInheritance|true
+detectorConfusionBetweenInheritedAndOuterMethod=ConfusionBetweenInheritedAndOuterMethod|true
+detectorCovariantArrayAssignment=CovariantArrayAssignment|false
+detectorCrossSiteScripting=CrossSiteScripting|true
+detectorDefaultEncodingDetector=DefaultEncodingDetector|true
+detectorDoInsideDoPrivileged=DoInsideDoPrivileged|true
+detectorDontCatchIllegalMonitorStateException=DontCatchIllegalMonitorStateException|true
+detectorDontIgnoreResultOfPutIfAbsent=DontIgnoreResultOfPutIfAbsent|true
+detectorDontUseEnum=DontUseEnum|true
+detectorDroppedException=DroppedException|true
+detectorDumbMethodInvocations=DumbMethodInvocations|true
+detectorDumbMethods=DumbMethods|true
+detectorDuplicateBranches=DuplicateBranches|true
+detectorEmptyZipFileEntry=EmptyZipFileEntry|true
+detectorEqualsOperandShouldHaveClassCompatibleWithThis=EqualsOperandShouldHaveClassCompatibleWithThis|true
+detectorExplicitSerialization=ExplicitSerialization|true
+detectorFinalizerNullsFields=FinalizerNullsFields|true
+detectorFindBadCast2=FindBadCast2|true
+detectorFindBadForLoop=FindBadForLoop|true
+detectorFindCircularDependencies=FindCircularDependencies|false
+detectorFindComparatorProblems=FindComparatorProblems|true
+detectorFindDeadLocalStores=FindDeadLocalStores|true
+detectorFindDoubleCheck=FindDoubleCheck|true
+detectorFindEmptySynchronizedBlock=FindEmptySynchronizedBlock|true
+detectorFindFieldSelfAssignment=FindFieldSelfAssignment|true
+detectorFindFinalizeInvocations=FindFinalizeInvocations|true
+detectorFindFloatEquality=FindFloatEquality|true
+detectorFindHEmismatch=FindHEmismatch|true
+detectorFindInconsistentSync2=FindInconsistentSync2|true
+detectorFindJSR166LockMonitorenter=FindJSR166LockMonitorenter|true
+detectorFindLocalSelfAssignment2=FindLocalSelfAssignment2|true
+detectorFindMaskedFields=FindMaskedFields|true
+detectorFindMismatchedWaitOrNotify=FindMismatchedWaitOrNotify|true
+detectorFindNakedNotify=FindNakedNotify|true
+detectorFindNonShortCircuit=FindNonShortCircuit|true
+detectorFindNullDeref=FindNullDeref|true
+detectorFindNullDerefsInvolvingNonShortCircuitEvaluation=FindNullDerefsInvolvingNonShortCircuitEvaluation|true
+detectorFindOpenStream=FindOpenStream|true
+detectorFindPuzzlers=FindPuzzlers|true
+detectorFindRefComparison=FindRefComparison|true
+detectorFindReturnRef=FindReturnRef|true
+detectorFindRoughConstants=FindRoughConstants|true
+detectorFindRunInvocations=FindRunInvocations|true
+detectorFindSelfComparison=FindSelfComparison|true
+detectorFindSelfComparison2=FindSelfComparison2|true
+detectorFindSleepWithLockHeld=FindSleepWithLockHeld|true
+detectorFindSpinLoop=FindSpinLoop|true
+detectorFindSqlInjection=FindSqlInjection|true
+detectorFindTwoLockWait=FindTwoLockWait|true
+detectorFindUncalledPrivateMethods=FindUncalledPrivateMethods|true
+detectorFindUnconditionalWait=FindUnconditionalWait|true
+detectorFindUninitializedGet=FindUninitializedGet|true
+detectorFindUnrelatedTypesInGenericContainer=FindUnrelatedTypesInGenericContainer|true
+detectorFindUnreleasedLock=FindUnreleasedLock|true
+detectorFindUnsatisfiedObligation=FindUnsatisfiedObligation|true
+detectorFindUnsyncGet=FindUnsyncGet|true
+detectorFindUseOfNonSerializableValue=FindUseOfNonSerializableValue|true
+detectorFindUselessControlFlow=FindUselessControlFlow|true
+detectorFindUselessObjects=FindUselessObjects|true
+detectorFormatStringChecker=FormatStringChecker|true
+detectorHugeSharedStringConstants=HugeSharedStringConstants|true
+detectorIDivResultCastToDouble=IDivResultCastToDouble|true
+detectorIncompatMask=IncompatMask|true
+detectorInconsistentAnnotations=InconsistentAnnotations|true
+detectorInefficientIndexOf=InefficientIndexOf|false
+detectorInefficientInitializationInsideLoop=InefficientInitializationInsideLoop|false
+detectorInefficientMemberAccess=InefficientMemberAccess|false
+detectorInefficientToArray=InefficientToArray|true
+detectorInfiniteLoop=InfiniteLoop|true
+detectorInfiniteRecursiveLoop=InfiniteRecursiveLoop|true
+detectorInheritanceUnsafeGetResource=InheritanceUnsafeGetResource|true
+detectorInitializationChain=InitializationChain|true
+detectorInitializeNonnullFieldsInConstructor=InitializeNonnullFieldsInConstructor|true
+detectorInstantiateStaticClass=InstantiateStaticClass|true
+detectorIntCast2LongAsInstant=IntCast2LongAsInstant|true
+detectorInvalidJUnitTest=InvalidJUnitTest|true
+detectorIteratorIdioms=IteratorIdioms|true
+detectorLazyInit=LazyInit|true
+detectorLoadOfKnownNullValue=LoadOfKnownNullValue|true
+detectorLostLoggerDueToWeakReference=LostLoggerDueToWeakReference|true
+detectorMethodReturnCheck=MethodReturnCheck|true
+detectorMultithreadedInstanceAccess=MultithreadedInstanceAccess|true
+detectorMutableEnum=MutableEnum|true
+detectorMutableLock=MutableLock|true
+detectorMutableStaticFields=MutableStaticFields|true
+detectorNaming=Naming|true
+detectorNoteUnconditionalParamDerefs=NoteUnconditionalParamDerefs|true
+detectorNumberConstructor=NumberConstructor|true
+detectorOptionalReturnNull=OptionalReturnNull|true
+detectorOverridingEqualsNotSymmetrical=OverridingEqualsNotSymmetrical|true
+detectorPreferZeroLengthArrays=PreferZeroLengthArrays|true
+detectorPublicSemaphores=PublicSemaphores|false
+detectorQuestionableBooleanAssignment=QuestionableBooleanAssignment|true
+detectorReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass=ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass|true
+detectorReadReturnShouldBeChecked=ReadReturnShouldBeChecked|true
+detectorRedundantConditions=RedundantConditions|true
+detectorRedundantInterfaces=RedundantInterfaces|true
+detectorRepeatedConditionals=RepeatedConditionals|true
+detectorRuntimeExceptionCapture=RuntimeExceptionCapture|true
+detectorSerializableIdiom=SerializableIdiom|true
+detectorStartInConstructor=StartInConstructor|true
+detectorStaticCalendarDetector=StaticCalendarDetector|true
+detectorStringConcatenation=StringConcatenation|true
+detectorSuperfluousInstanceOf=SuperfluousInstanceOf|true
+detectorSuspiciousThreadInterrupted=SuspiciousThreadInterrupted|true
+detectorSwitchFallthrough=SwitchFallthrough|true
+detectorSynchronizationOnSharedBuiltinConstant=SynchronizationOnSharedBuiltinConstant|true
+detectorSynchronizeAndNullCheckField=SynchronizeAndNullCheckField|true
+detectorSynchronizeOnClassLiteralNotGetClass=SynchronizeOnClassLiteralNotGetClass|true
+detectorSynchronizingOnContentsOfFieldToProtectField=SynchronizingOnContentsOfFieldToProtectField|true
+detectorURLProblems=URLProblems|true
+detectorUncallableMethodOfAnonymousClass=UncallableMethodOfAnonymousClass|true
+detectorUnnecessaryMath=UnnecessaryMath|true
+detectorUnreadFields=UnreadFields|true
+detectorUselessSubclassMethod=UselessSubclassMethod|false
+detectorVarArgsProblems=VarArgsProblems|true
+detectorVolatileUsage=VolatileUsage|true
+detectorWaitInLoop=WaitInLoop|true
+detectorWrongMapIterator=WrongMapIterator|true
+detectorXMLFactoryBypass=XMLFactoryBypass|true
+detector_threshold=2
+effort=default
+excludefilter0=.settings/findbugs-exclude.xml|true
+filter_settings=Medium|BAD_PRACTICE,CORRECTNESS,EXPERIMENTAL,MALICIOUS_CODE,MT_CORRECTNESS,PERFORMANCE,SECURITY,STYLE|false|20
+filter_settings_neg=NOISE,I18N|
+run_at_full_build=true
diff --git a/jack-server/.settings/org.eclipse.core.resources.prefs b/jack-server/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..99f26c02
--- /dev/null
+++ b/jack-server/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/jack-server/.settings/org.eclipse.jdt.apt.core.prefs b/jack-server/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 00000000..7d52ece5
--- /dev/null
+++ b/jack-server/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=true
+org.eclipse.jdt.apt.genSrcDir=.apt_generated
+org.eclipse.jdt.apt.reconcileEnabled=true
diff --git a/jack-server/.settings/org.eclipse.jdt.core.prefs b/jack-server/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..09ff51d3
--- /dev/null
+++ b/jack-server/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,427 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.CheckForNull
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.processAnnotations=enabled
+org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependent=1585|-1|1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable.count_dependent=1585|-1|1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method.count_dependent=1585|-1|1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package.count_dependent=1585|-1|1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=1040
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter.count_dependent=1040|-1|1040
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=1585
+org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type.count_dependent=1585|-1|1585
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression.count_dependent=16|4|80
+org.eclipse.jdt.core.formatter.alignment_for_assignment=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments=16
+org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants.count_dependent=16|5|48
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
+org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
+org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields.count_dependent=16|-1|16
+org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=20
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration.count_dependent=16|5|80
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count_dependent=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration.count_dependent=16|4|49
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration.count_dependent=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration.count_dependent=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration.count_dependent=16|4|48
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comment_prefix=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
+org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
+org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
diff --git a/jack-server/.settings/org.eclipse.jdt.ui.prefs b/jack-server/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..d44207bd
--- /dev/null
+++ b/jack-server/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,63 @@
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Jack Format 100
+formatter_settings_version=13
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com.google;android;antenna;antlr;ar;asposewobfuscated;asquare;atg;au;beaver;bibtex;bmsi;bsh;ccl;cern;ChartDirector;checkers;com;COM;common;contribs;corejava;cryptix;cybervillains;dalvik;danbikel;de;EDU;eg;eu;examples;fat;fit;fitlibrary;fmpp;freemarker;gnu;groovy;groovyjarjarantlr;groovyjarjarasm;hak;hep;ie;imageinfo;info;it;jal;Jama;japa;japacheckers;jas;jasmin;javancss;javanet;javassist;javazoom;java_cup;jcifs;jetty;JFlex;jj2000;jline;jp;JSci;jsr166y;junit;jxl;jxxload_help;kawa;kea;libcore;libsvm;lti;memetic;mt;mx4j;net;netscape;nl;nu;oauth;ognl;opennlp;oracle;org;penn2dg;pennconverter;pl;prefuse;proguard;repackage;scm;se;serp;simple;soot;sqlj;src;ssa;sun;sunlabs;tcl;testdata;testshell;testsuite;twitter4j;uk;ViolinStrings;weka;wet;winstone;woolfel;wowza;;java;javax;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=999
+org.eclipse.jdt.ui.staticondemandthreshold=999
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * Copyright (C) ${year} The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment"/><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=false
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=false
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=false
+sp_cleanup.remove_unused_private_types=false
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/jack-server/.settings/org.eclipse.ltk.core.refactoring.prefs b/jack-server/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 00000000..b196c64a
--- /dev/null
+++ b/jack-server/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/jack-server/Android.mk b/jack-server/Android.mk
new file mode 100644
index 00000000..bf234296
--- /dev/null
+++ b/jack-server/Android.mk
@@ -0,0 +1,41 @@
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := jack-server
+LOCAL_MODULE_TAGS := optional
+LOCAL_JAVACFLAGS := -target 1.7 -source 1.7
+LOCAL_SRC_FILES := $(call all-java-files-under,src)
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ simple-jack
+LOCAL_JAVA_LIBRARIES := \
+ sched-build \
+ allocation-jack \
+ ecj-jack \
+ guava-jack \
+ jsr305lib-jack \
+ dx-jack \
+ schedlib \
+ freemarker-jack \
+ watchmaker-jack \
+ maths-jack \
+ args4j-jack \
+ antlr-runtime-jack \
+ jack-api \
+ jack-no-server
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/jack-server/MODULE_LICENSE_APACHE2 b/jack-server/MODULE_LICENSE_APACHE2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/jack-server/MODULE_LICENSE_APACHE2
diff --git a/jack-server/NOTICE b/jack-server/NOTICE
new file mode 100644
index 00000000..2bb9ad24
--- /dev/null
+++ b/jack-server/NOTICE
@@ -0,0 +1,176 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS \ No newline at end of file
diff --git a/jack-server/jackstyle.xml b/jack-server/jackstyle.xml
new file mode 100644
index 00000000..39409738
--- /dev/null
+++ b/jack-server/jackstyle.xml
@@ -0,0 +1,314 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!-- This is a checkstyle configuration file. For descriptions of
+what the following rules do, please see the checkstyle configuration
+page at http://checkstyle.sourceforge.net/config.html -->
+
+<!-- Checks with numbered comments refer to recommendations made
+by Joshua Bloch in his book Effective Java -->
+
+<module name="Checker">
+ <property name="charset" value="UTF-8"/>
+ <module name="FileTabCharacter">
+ <!-- Checks that there are no tab characters in the file.
+ -->
+ </module>
+
+ <module name="RegexpSingleline">
+ <!-- Checks that FIXME is not used in comments. TODO is preferred.
+ -->
+ <property name="format" value="((//.*)|(\*.*))FIXME" />
+ <property name="message" value='TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released."' />
+ </module>
+
+ <module name="RegexpSingleline">
+ <!-- Checks that TODOs are properly formatted.
+
+ The (?&lt;!TODO\(.{0,100}) makes the regex ignore any secondary TODO's on the line
+ so that things like //TODO(bob): remove this TODO on 1/1/2020 don't trigger a warning
+ because of the second TODO. (The {0,100} is because java doesn't recoginize arbitrary
+ length look backs, but we know each java line should be < 100 chars.)
+ -->
+ <property name="format" value="((//.*)|(\*.*))(?&lt;!TODO\(.{0,100})(TODO[^(])|(TODO\([^)]*$)" />
+ <property name="message" value='All TODOs should be named. e.g. "TODO(johndoe): Refactor when v2 is released."' />
+ </module>
+
+
+ <!-- All Java AST specific tests live under TreeWalker module. -->
+ <module name="TreeWalker">
+
+ <!--
+
+ IMPORT CHECKS
+
+ -->
+
+ <module name="RedundantImport">
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="AvoidStarImport">
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="UnusedImports">
+ <!-- DPL is a notable violator of this rule. -->
+ <property name="severity" value="error"/>
+ <!-- Imports used only in Javadoc are tolerated. -->
+ <property name="processJavadoc" value="true"/>
+ <message
+ key="import.unused"
+ value="Unused import: {0}." />
+ </module>
+
+ <module name="ImportOrder">
+ <!-- Checks for out of order import statements. -->
+ <property name="severity" value="warning"/>
+ <property name="groups" value="com.google,*,java,javax"/>
+ <!-- This ensures that static imports go first. -->
+ <property name="option" value="top"/>
+ <property name="tokens" value="STATIC_IMPORT, IMPORT"/>
+ </module>
+
+ <!--
+
+ JAVADOC CHECKS
+
+ -->
+
+ <module name="JavadocType">
+ <!-- Item 28 - Write doc comments for all exposed API elements. -->
+ <!-- Ensure all classes with visability greater than or equal to
+ protected have class level documentation. -->
+ <property name="scope" value="protected"/>
+ <property name="severity" value="error"/>
+ <!-- Style guide doesn't prohibit custom tags. Typos will be caught by other tools. -->
+ <property name="allowUnknownTags" value="true"/>
+ <property name="allowMissingParamTags" value="true"/>
+ <message key="javadoc.missing"
+ value="Missing a Javadoc comment."/>
+ </module>
+
+ <!--
+
+ NAMING CHECKS
+
+ -->
+
+ <!-- Item 38 - Adhere to generally accepted naming conventions -->
+
+ <module name="PackageName">
+ <!-- Validates identifiers for package names against the
+ supplied expression. -->
+ <!-- Here the default checkstyle rule restricts package name parts to
+ seven characters, this is not in line with common practice at Google.
+ -->
+ <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="TypeNameCheck">
+ <metadata name="altname" value="TypeName"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="StaticVariableNameCheck">
+ <!-- Validates static, non-final fields against the supplied
+ expression "^[a-z][a-zA-Z0-9]*?$". -->
+ <metadata name="altname" value="StaticVariableName"/>
+ <property name="applyToPublic" value="true"/>
+ <property name="applyToProtected" value="true"/>
+ <property name="applyToPackage" value="true"/>
+ <property name="applyToPrivate" value="true"/>
+ <property name="format" value="^[a-z][a-zA-Z0-9]*?$"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="MemberNameCheck">
+ <!-- Validates non-static members against the supplied expression. -->
+ <metadata name="altname" value="MemberName"/>
+ <property name="applyToPublic" value="true"/>
+ <property name="applyToProtected" value="true"/>
+ <property name="applyToPackage" value="true"/>
+ <property name="applyToPrivate" value="true"/>
+ <property name="format" value="^[a-z][a-zA-Z0-9]*?$"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="MethodNameCheck">
+ <!-- Validates identifiers for method names. -->
+ <metadata name="altname" value="MethodName"/>
+ <property name="format" value="^[a-z][a-zA-Z0-9]*([a-zA-Z0-9]+)*$"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="ParameterName">
+ <!-- Validates identifiers for method parameters against the
+ expression "^[a-z][a-zA-Z0-9]*$". -->
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="LocalFinalVariableName">
+ <!-- Validates identifiers for local final variables against the
+ expression "^[a-z][a-zA-Z0-9]*$". -->
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="LocalVariableName">
+ <!-- Validates identifiers for local variables against the
+ expression "^[a-z][a-zA-Z0-9]*$". -->
+ <property name="severity" value="warning"/>
+ </module>
+
+
+ <!--
+
+ LENGTH and CODING CHECKS
+
+ -->
+
+ <module name="LineLength">
+ <!-- Checks if a line is too long. -->
+ <property name="max" value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.max}" default="100"/>
+ <property name="severity" value="error"/>
+
+ <!--
+ The default ignore pattern exempts the following elements:
+ - import statements
+ - long URLs inside comments
+ -->
+
+ <property name="ignorePattern"
+ value="${com.puppycrawl.tools.checkstyle.checks.sizes.LineLength.ignorePattern}"
+ default="^(package .*;\s*)|(import .*;\s*)|( *\* *https?://.*)|(\s*@[\w\.\$]+::\w+(?:\([^\(]*\)|\(\)\(\))?[,;]?)|(\s+\* \{@(link|see) [^\s][^\}]*\}[\.,;]?)$"/>
+ </module>
+
+ <module name="LeftCurly">
+ <!-- Checks for placement of the left curly brace ('{'). -->
+ <property name="severity" value="warning"/>
+ </module>
+
+ <module name="RightCurly">
+ <!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
+ the same line. e.g., the following example is fine:
+ <pre>
+ if {
+ ...
+ } else
+ </pre>
+ -->
+ <!-- This next example is not fine:
+ <pre>
+ if {
+ ...
+ }
+ else
+ </pre>
+ -->
+ <property name="option" value="same"/>
+ <property name="severity" value="warning"/>
+ </module>
+
+ <!-- Checks for braces around if and else blocks -->
+ <module name="NeedBraces">
+ <property name="severity" value="warning"/>
+ <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/>
+ </module>
+
+ <module name="UpperEll">
+ <!-- Checks that long constants are defined with an upper ell.-->
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="FallThrough">
+ <!-- Warn about falling through to the next case statement. Similar to
+ javac -Xlint:fallthrough, but the check is suppressed if there is a single-line comment
+ on the last non-blank line preceding the fallen-into case.
+ -->
+ <property name="reliefPattern"
+ value=".*"/>
+ <property name="severity" value="error"/>
+ </module>
+
+
+ <!--
+
+ MODIFIERS CHECKS
+
+ -->
+
+ <module name="ModifierOrder">
+ <!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
+ 8.4.3. The prescribed order is:
+ public, protected, private, abstract, static, final, transient, volatile,
+ synchronized, native, strictfp
+ -->
+ </module>
+
+
+ <!--
+
+ WHITESPACE CHECKS
+
+ -->
+
+ <module name="WhitespaceAround">
+ <!-- Checks that various tokens are surrounded by whitespace.
+ This includes most binary operators and keywords followed
+ by regular or curly braces.
+ -->
+ <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
+ BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
+ EQUAL, GE, GT, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
+ LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
+ LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
+ MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
+ SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="WhitespaceAfter">
+ <!-- Checks that commas, semicolons and typecasts are followed by
+ whitespace.
+ -->
+ <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
+ </module>
+
+ <module name="NoWhitespaceAfter">
+ <!-- Checks that there is no whitespace after various unary operators.
+ Linebreaks are allowed.
+ -->
+ <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
+ UNARY_PLUS"/>
+ <property name="allowLineBreaks" value="true"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="NoWhitespaceBefore">
+ <!-- Checks that there is no whitespace before various unary operators.
+ Linebreaks are allowed.
+ -->
+ <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
+ <property name="allowLineBreaks" value="true"/>
+ <property name="severity" value="error"/>
+ </module>
+
+ <module name="ParenPad">
+ <!-- Checks that there is no whitespace before close parens or after
+ open parens.
+ -->
+ <property name="severity" value="warning"/>
+ </module>
+
+ <!--
+
+ MISC CHECKS
+
+ -->
+
+ </module>
+</module>
+
diff --git a/jack-server/src/com/android/jack/server/JackSimpleServer.java b/jack-server/src/com/android/jack/server/JackSimpleServer.java
new file mode 100644
index 00000000..4f27b4ad
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/JackSimpleServer.java
@@ -0,0 +1,704 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.google.common.base.Joiner;
+
+import com.android.sched.util.config.cli.TokenIterator;
+import com.android.sched.util.file.OutputStreamFile;
+import com.android.sched.util.findbugs.SuppressFBWarnings;
+import com.android.sched.util.location.NoLocation;
+import com.android.sched.util.log.tracer.probe.MemoryBytesProbe;
+import com.android.sched.util.log.tracer.probe.TimeNanosProbe;
+
+import org.simpleframework.http.Path;
+import org.simpleframework.http.Request;
+import org.simpleframework.http.Response;
+import org.simpleframework.http.Status;
+import org.simpleframework.http.core.Container;
+import org.simpleframework.http.core.ContainerSocketProcessor;
+import org.simpleframework.http.parse.PathParser;
+import org.simpleframework.transport.connect.Connection;
+import org.simpleframework.transport.connect.SocketConnection;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.lang.management.CompilationMXBean;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+/**
+ * Server controlling the number of Jack compilations that are executed simultaneously.
+ */
+public class JackSimpleServer {
+ private static int port;
+
+ @Nonnull
+ private static final ServerTask serviceTest = new ServerTask() {
+ @Nonnull
+ private final Random rnd = new Random();
+
+ @Override
+ public int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File workingDir,
+ @Nonnull TokenIterator args) {
+ String cmd = null;
+ try {
+ args.hasNext();
+ cmd = args.next();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+
+ out.println("Pre-test stdout for '" + workingDir.getPath() + "' from " + port);
+ err.println("Pre-test stderr for '" + cmd + "' from " + port);
+
+ try {
+ Thread.sleep(rnd.nextInt(3000));
+ } catch (InterruptedException e) {
+ // Doesn't matter
+ }
+
+ out.println("Post-test stdout for '" + workingDir.getPath() + "' from " + port);
+ err.println("Post-test stderr for '" + cmd + "' from " + port);
+
+ return rnd.nextInt(30);
+ }
+ };
+
+ @Nonnull
+ private static ServerTask service = new ServerTaskInsideVm();
+
+ @Nonnull
+ private static Logger logger = Logger.getLogger(JackSimpleServer.class.getSimpleName());
+
+ private static final int CMD_IDX_CMD = 0;
+ private static final int CMD_IDX_OUT = 1;
+ private static final int CMD_IDX_ERR = 2;
+ private static final int CMD_IDX_CLI = 3;
+ private static final int CMD_IDX_END = 4;
+
+ private static final int CLI_IDX_PORT = 0;
+ private static final int CLI_IDX_COUNT = 1;
+ private static final int CLI_IDX_MAX = 2;
+ private static final int CLI_IDX_TIEMOUT = 3;
+ private static final int CLI_IDX_END = 4;
+
+ @CheckForNull
+ private static Connection connection;
+ @CheckForNull
+ private static Timer timer;
+ @Nonnull
+ private static Lock lock = new ReentrantLock();
+
+ private static int timeout;
+
+ private static int currentLocal = 0;
+ private static long totalLocal = 0;
+ private static int maxLocal = 0;
+
+ private static int currentForward = 0;
+ private static long totalForward = 0;
+ private static int maxForward = 0;
+
+ public static void main(String[] args) {
+ if (args.length != CLI_IDX_END) {
+ logger.log(Level.SEVERE,
+ "Usage: <port-nb> <server-count> <max-compile> <timeout-s>");
+ abort();
+ }
+
+ port = 0;
+ try {
+ port = Integer.parseInt(args[CLI_IDX_PORT]);
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse port number '" + args[CLI_IDX_PORT] + "'");
+ abort();
+ }
+
+ logger = Logger.getLogger(JackSimpleServer.class.getSimpleName() + "." + port);
+
+ int count = 0;
+ try {
+ count = Integer.parseInt(args[CLI_IDX_COUNT]);
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse server count '" + args[CLI_IDX_COUNT] + "'");
+ abort();
+ }
+
+ int nbInstance = 0;
+ try {
+ nbInstance = Integer.parseInt(args[CLI_IDX_MAX]);
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse instance count '" + args[CLI_IDX_MAX] + "'");
+ abort();
+ }
+
+ try {
+ timeout = Integer.parseInt(args[CLI_IDX_TIEMOUT]) * 1000;
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse timeout '" + args[CLI_IDX_TIEMOUT] + "'");
+ abort();
+ }
+
+ InetSocketAddress socket = new InetSocketAddress("127.0.0.1", port);
+
+ logger.log(Level.INFO, "Starting simple server on " + socket);
+ try {
+ JackRouter router = new JackRouter();
+ router.addContainer(new PathParser("/jack"), new JackRun());
+ router.addContainer(new PathParser("/gc"), new JackGc());
+ router.addContainer(new PathParser("/stat"), new JackStat());
+
+ ContainerSocketProcessor processor =
+ new ContainerSocketProcessor(router, nbInstance);
+ connection = new SocketConnection(processor);
+ assert connection != null;
+ connection.connect(socket);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Problem during connection ", e);
+ abort();
+ }
+ }
+
+ private static class JackRouter implements Container {
+ @Nonnull
+ private final Map<String, Container> registry = new HashMap<String, Container>();
+ @Nonnull
+ private final Container primary;
+
+ public JackRouter() {
+ primary = new Container() {
+ @Override
+ public void handle(@Nonnull Request request, @Nonnull Response response) {
+ logger.log(Level.INFO, "Unknown request for '" + request.getPath().getPath() + "'");
+ response.setStatus(Status.NOT_FOUND);
+ }
+ };
+ }
+
+ public JackRouter(@Nonnull Container primary) {
+ this.primary = primary;
+ }
+
+ public void addContainer(@Nonnull Path path, @Nonnull Container container) {
+ registry.put(path.getPath(), container);
+ }
+
+ @Override
+ public void handle(@Nonnull Request request, @Nonnull Response response) {
+ String normalizedPath = request.getPath().getPath();
+
+ logger.log(Level.INFO, "Route request from '" + normalizedPath + "'");
+
+ Container container = registry.get(normalizedPath);
+ if (container != null) {
+ container.handle(request, response);
+ } else {
+ primary.handle(request, response);
+ }
+ }
+ }
+
+ private static class JackRun implements Container {
+ @Override
+ public void handle(@Nonnull Request request, @Nonnull Response response) {
+ try {
+ String line;
+
+ try {
+ line = request.getContent();
+ } catch (IOException e1) {
+ logger.log(Level.SEVERE, "Command read command");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ if (line == null) {
+ logger.log(Level.SEVERE, "Command error: nothing to read");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ String[] command = line.split(" ");
+
+ if (!command[CMD_IDX_CMD].equals("+")) {
+ logger.log(Level.SEVERE, "Command error '" + line + "'");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ logger.log(Level.INFO, "Read command '" + line + "'");
+
+ PrintStream out = null;
+ PrintStream err = null;
+
+ long id;
+
+ lock.lock();
+ try {
+ id = totalLocal;
+ totalLocal++;
+ if (currentLocal == 0) {
+ cancelTimer();
+ }
+ currentLocal++;
+ logger.log(Level.INFO, "Number of concurrent compilations: " + currentLocal);
+ if (currentLocal > maxLocal) {
+ maxLocal = currentLocal;
+ }
+ } finally {
+ lock.unlock();
+ }
+
+ try {
+ if (command.length != CMD_IDX_END) {
+ logger.log(Level.SEVERE, "Command format error '" + line + "'");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ logger.log(Level.INFO, "Open standard output '" + command[CMD_IDX_OUT] + "'");
+ try {
+ out = new OutputStreamFile(command[CMD_IDX_OUT]).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ logger.log(Level.INFO, "Open standard error '" + command[CMD_IDX_ERR] + "'");
+ try {
+ err = new OutputStreamFile(command[CMD_IDX_ERR]).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ logger.log(Level.INFO, "Parse command line");
+ TokenIterator args = new TokenIterator(new NoLocation(), "@" + command[CMD_IDX_CLI]);
+ args.allowFileReferenceInFile();
+ if (!args.hasNext()) {
+ logger.log(Level.SEVERE, "Cli format error");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ String workingDir;
+ try {
+ workingDir = args.next();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Cli format error");
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+
+ int code = -1;
+ long start = System.currentTimeMillis();
+ try {
+ logger.log(Level.INFO, "Run Compilation #" + id);
+ start = System.currentTimeMillis();
+ code = service.run(out, err, new File(workingDir), args);
+ } finally {
+ long stop = System.currentTimeMillis();
+ logger.log(Level.INFO, "Compilation #" + id + " return exit code " + code);
+ logger.log(Level.INFO, "Compilation #" + id + " run in " + (stop - start) + " ms");
+
+ response.setStatus(Status.OK);
+
+ PrintStream printer;
+ try {
+ printer = response.getPrintStream();
+ printer.println(code);
+ printer.close();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Problem to send exit code for compilation #" + id);
+ response.setStatus(Status.BAD_REQUEST);
+ return;
+ }
+ }
+ } finally {
+ if (out != null) {
+ out.close();
+ } else {
+ unblock(command[CMD_IDX_OUT]);
+ }
+
+ if (err != null) {
+ err.close();
+ } else {
+ unblock(command[CMD_IDX_ERR]);
+ }
+
+ lock.lock();
+ try {
+ currentLocal--;
+ if (currentLocal == 0) {
+ startTimer();
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+ } finally {
+ try {
+ response.close();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Exception during close: ", e);
+ }
+ }
+
+ return;
+ }
+ }
+
+ private static class JackStat implements Container {
+ @Override
+ public void handle(@Nonnull Request request, @Nonnull Response response) {
+ try {
+ response.setStatus(Status.OK);
+ PrintStream printer = response.getPrintStream();
+
+ long time = System.currentTimeMillis();
+ Date date = new Date(time);
+ printer.println("date: " + time + " [" + date + "]");
+
+ try {
+ lock.lock();
+ try {
+ printer.println("server.compilation: " + totalLocal);
+ printer.println("server.compilation.max: " + maxLocal);
+ printer.println("server.compilation.current: " + currentLocal);
+ printer.println("server.forward: " + totalForward);
+ printer.println("server.forward.max: " + maxForward);
+ printer.println("server.forward.current: " + currentForward);
+ } finally {
+ lock.unlock();
+ }
+
+ OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
+ printer.println("os.arch: " + os.getArch());
+ printer.println("os.proc.nb: " + Integer.valueOf(os.getAvailableProcessors()));
+ printer.println("os.name: " + os.getName());
+ printer.println("os.version: " + os.getVersion());
+
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+ printer.println("vm.name: " + runtime.getVmName());
+ printer.println("vm.vendor: " + runtime.getVmVendor());
+ printer.println("vm.version: " + runtime.getVmVersion());
+ printer.println("vm_options: "
+ + Joiner.on(' ').skipNulls().join(runtime.getInputArguments()));
+ printer.println("vm.memory.max: " + formatQuatity(Runtime.getRuntime().maxMemory()));
+ printer.println("vm.memory.free: " + formatQuatity(Runtime.getRuntime().freeMemory()));
+ printer.println("vm.memory.total: " + formatQuatity(Runtime.getRuntime().totalMemory()));
+
+ try {
+ CompilationMXBean compilation = ManagementFactory.getCompilationMXBean();
+ printer.println("vm.jit.time: "
+ + formatDuration(compilation.getTotalCompilationTime(), TimeUnit.MILLISECONDS));
+ } catch (UnsupportedOperationException e) {
+ // Do the best
+ }
+
+ for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
+ String suffix = "vm.collector." + tranformString(gc.getName()) + ".";
+ printer.println(suffix + "time: "
+ + formatDuration(gc.getCollectionTime(), TimeUnit.MILLISECONDS));
+ printer.println(suffix + "count: " + gc.getCollectionCount());
+ }
+
+ for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
+ String suffix = "vm.pool." + tranformString(pool.getName()) + ".";
+ printer.println(suffix + "type: " + pool.getType().name());
+
+ printMemoryUsage(printer, suffix + "collection.", pool.getCollectionUsage());
+ try {
+ printer.println(suffix + "collection.threshold: "
+ + formatQuatity(pool.getCollectionUsageThreshold()));
+ } catch (UnsupportedOperationException e) {
+ // Best effort
+ }
+
+ try {
+ printer.println(suffix + "collection.threshold.count: "
+ + pool.getCollectionUsageThresholdCount());
+ } catch (UnsupportedOperationException e) {
+ // Best effort
+ }
+
+ printMemoryUsage(printer, suffix + "peak.", pool.getPeakUsage());
+
+ printMemoryUsage(printer, suffix + "usage.", pool.getUsage());
+ try {
+ printer.println(suffix + "usage.threshold: "
+ + formatQuatity(pool.getUsageThreshold()));
+ } catch (UnsupportedOperationException e) {
+ // Best effort
+ }
+ try {
+ printer.println(suffix + "usage.threshold.count: " + pool.getUsageThresholdCount());
+ } catch (UnsupportedOperationException e) {
+ // Best effort
+ }
+ }
+
+ try {
+ printer.println("host.name: " + InetAddress.getLocalHost().getHostName());
+ } catch (UnknownHostException e1) {
+ // Best effort
+ }
+
+ Method method;
+ try {
+ method = os.getClass().getMethod("getCommittedVirtualMemorySize");
+ method.setAccessible(true);
+ printer.println("os.memory.virtual.committed: "
+ + formatQuatity(((Long) method.invoke(os)).longValue()));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getTotalPhysicalMemorySize");
+ method.setAccessible(true);
+ printer.println("os.memory.physical.total: "
+ + formatQuatity(((Long) method.invoke(os)).longValue()));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getFreePhysicalMemorySize");
+ method.setAccessible(true);
+ printer.println("os.memory.physical.free: "
+ + formatQuatity(((Long) method.invoke(os)).longValue()));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getTotalSwapSpaceSize");
+ method.setAccessible(true);
+ printer.println("os.memory.swap.total: "
+ + formatQuatity(((Long) method.invoke(os)).longValue()));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getFreeSwapSpaceSize");
+ method.setAccessible(true);
+ printer.println("os.memory.swap.free: "
+ + formatQuatity(((Long) method.invoke(os)).longValue()));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getOpenFileDescriptorCount");
+ method.setAccessible(true);
+ printer.println("os.fd.open: " + ((Long) method.invoke(os)).longValue());
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+
+ try {
+ method = os.getClass().getMethod("getProcessCpuLoad");
+ method.setAccessible(true);
+ printer.println("os.process.cpu.load: " + ((Double) method.invoke(os)).doubleValue());
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getProcessCpuTime");
+ method.setAccessible(true);
+ printer.println("os.process.cpu.time: "
+ + formatDuration(((Long) method.invoke(os)).longValue(), TimeUnit.NANOSECONDS));
+ } catch (Throwable t) {
+ // Best effort
+ }
+
+ try {
+ method = os.getClass().getMethod("getSystemCpuLoad");
+ method.setAccessible(true);
+ printer.println("os.system.cpu.load: " + ((Double) method.invoke(os)).doubleValue());
+ } catch (Throwable t) {
+ // Best effort
+ }
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, "Unexpected exception: ", e);
+ }
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Exception during IO: ", e);
+ } finally {
+ try {
+ response.close();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Exception during close: ", e);
+ }
+ }
+ }
+ }
+
+ static void printMemoryUsage(@Nonnull PrintStream printer, @Nonnull String suffix,
+ @CheckForNull MemoryUsage usage) {
+ if (usage != null) {
+ printer.println(suffix + "commited: " + formatQuatity(usage.getCommitted()));
+ printer.println(suffix + "itnit: " + formatQuatity(usage.getInit()));
+ printer.println(suffix + "max: " + formatQuatity(usage.getMax()));
+ printer.println(suffix + "used: " + formatQuatity(usage.getUsed()));
+ }
+ }
+
+ @Nonnull
+ static String formatDuration(@Nonnull long duration, @Nonnull TimeUnit unit) {
+ String str = Long.toString(duration);
+
+ str += " [";
+ str += TimeNanosProbe.formatDuration(unit.toNanos(duration));
+ str += "]";
+
+ return str;
+ }
+
+ @Nonnull
+ static String formatQuatity(@Nonnull long quantity) {
+ String str = Long.toString(quantity);
+
+ str += " [";
+ str += MemoryBytesProbe.formatBytes(quantity);
+ str += "]";
+
+ return str;
+ }
+
+ @Nonnull
+ static String tranformString(@Nonnull String string) {
+ return string.toLowerCase().replace(' ', '-');
+ }
+
+ @SuppressFBWarnings("DM_GC")
+ private static class JackGc implements Container {
+ @Override
+ public void handle(@Nonnull Request request, @Nonnull Response response) {
+ logger.log(Level.INFO, "Force GC");
+ System.gc();
+ response.setStatus(Status.OK);
+ try {
+ response.close();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Exception during close: ", e);
+ }
+ }
+ }
+
+ private static void abort() {
+ logger.log(Level.SEVERE, "Abort sever");
+ System.exit(1);
+ }
+
+ private static void unblock(@Nonnull String name) {
+ logger.log(Level.INFO, "Trying to unblock '" + name + "'");
+ PrintStream out = null;
+ try {
+ out = new OutputStreamFile(name).getPrintStream();
+ } catch (IOException e) {
+ // Best effort
+ }
+
+ if (out != null) {
+ out.close();
+ }
+ }
+
+ private static void startTimer() {
+ lock.lock();
+ try {
+ if (timer != null) {
+ cancelTimer();
+ }
+
+ logger.log(Level.INFO, "Start timer");
+
+ timer = new Timer("jack-server-timeout");
+ assert timer != null;
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ cancelTimer();
+
+ Connection conn = connection;
+ assert conn != null;
+
+ logger.log(Level.INFO, "Shutdowning server");
+ logger.log(Level.INFO, "# max of concurrent compilations: " + maxLocal);
+ logger.log(Level.INFO, "# total of compilations: " + totalLocal);
+ logger.log(Level.INFO, "# max of concurrent forward compilations: " + maxForward);
+ logger.log(Level.INFO, "# total of forward compilations: " + totalForward);
+ try {
+ conn.close();
+ logger.log(Level.INFO, "Done");
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Cannot shutdown the server: ", e);
+ }
+ }
+ }, timeout);
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ private static void cancelTimer() {
+ lock.lock();
+ try {
+ if (timer != null) {
+ logger.log(Level.INFO, "Cancel timer");
+
+ timer.cancel();
+ timer.purge();
+ timer = null;
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+}
diff --git a/jack-server/src/com/android/jack/server/Server.java b/jack-server/src/com/android/jack/server/Server.java
new file mode 100644
index 00000000..8ab31531
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/Server.java
@@ -0,0 +1,438 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.android.sched.util.config.cli.TokenIterator;
+import com.android.sched.util.file.AbstractStreamFile;
+import com.android.sched.util.file.OutputStreamFile;
+import com.android.sched.util.location.FileLocation;
+import com.android.sched.util.location.NoLocation;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Random;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+/**
+ * Server controlling the number of Jack compilations that are executed simultaneously.
+ */
+public class Server {
+ @Nonnull
+ private static ServerTask serviceTest = new ServerTask() {
+ @Nonnull
+ private final Random rnd = new Random();
+
+ @Override
+ public int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File workingDir,
+ @Nonnull TokenIterator args) {
+ String cmd = null;
+ try {
+ args.hasNext();
+ cmd = args.next();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+
+ out.println("Pre-test stdout for '" + workingDir.getPath() + "'");
+ err.println("Pre-test stderr for '" + cmd + "'");
+
+ try {
+ Thread.sleep(rnd.nextInt(3000));
+ } catch (InterruptedException e) {
+ // Doesn't matter
+ }
+
+ out.println("Post-test stdout for '" + workingDir.getPath() + "'");
+ err.println("Post-test stderr for '" + cmd + "'");
+
+ return rnd.nextInt(30);
+ }
+ };
+
+ @Nonnull
+ private static ServerTask service = new ServerTaskInsideVm();
+
+ @Nonnull
+ private static Logger logger = Logger.getLogger(Server.class.getSimpleName());
+
+ private static final int CMD_IDX_CMD = 0;
+ private static final int CMD_IDX_OUT = 1;
+ private static final int CMD_IDX_ERR = 2;
+ private static final int CMD_IDX_EXIT = 3;
+ private static final int CMD_IDX_CLI = 4;
+ private static final int CMD_IDX_END = 5;
+
+ private static final int CLI_IDX_MAX = 0;
+ private static final int CLI_IDX_TIEMOUT = 1;
+ private static final int CLI_IDX_FIFO = 2;
+ private static final int CLI_IDX_LOCK = 3;
+ private static final int CLI_IDX_END = 4;
+
+ @CheckForNull
+ private static File fifo;
+ @CheckForNull
+ private static File lock;
+ @CheckForNull
+ private static BufferedReader in;
+
+ private static int timeout;
+
+ @Nonnull
+ private static AtomicInteger nbMax = new AtomicInteger(0);
+ @Nonnull
+ private static AtomicLong nbCurrent = new AtomicLong(0);
+
+ public static void main(String[] args) throws InterruptedException {
+ if (args.length != CLI_IDX_END) {
+ logger.log(Level.SEVERE, "Usage: <max-compile> <timeout-s> <path-fifo> <path-lock>");
+ abort();
+ }
+
+ int nbInstance = 0;
+ try {
+ nbInstance = Integer.parseInt(args[CLI_IDX_MAX]);
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse instance count '" + args[CLI_IDX_MAX] + "'");
+ abort();
+ }
+
+ try {
+ timeout = Integer.parseInt(args[CLI_IDX_TIEMOUT]) * 1000;
+ } catch (NumberFormatException e) {
+ logger.log(Level.SEVERE, "Cannot parse timeout '" + args[CLI_IDX_TIEMOUT] + "'");
+ abort();
+ }
+
+ fifo = new File(args[CLI_IDX_FIFO]);
+ lock = new File(args[CLI_IDX_LOCK]);
+
+
+ try {
+ AbstractStreamFile.check(fifo, new FileLocation(fifo));
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ abort();
+ }
+
+ Runtime.getRuntime().addShutdownHook(new Thread(){
+ @Override
+ public void run() {
+ cancelTimer();
+ shutdownFifo();
+
+ if (!lock.delete()) {
+ logger.log(Level.SEVERE, "Can not remove lock file '" + lock.getPath() + "'");
+ }
+ }
+ });
+
+ startFifo();
+ startTimer();
+ try {
+ in = new BufferedReader(new FileReader(fifo));
+ } catch (FileNotFoundException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ abort();
+ }
+
+ assert fifo != null;
+ logger.log(Level.INFO, "Starting server on '" + fifo.getPath() + "'");
+ ExecutorService executor = Executors.newFixedThreadPool(nbInstance);
+ for (int i = 0; i < nbInstance; i++) {
+ logger.log(Level.FINE, "Launching task #" + i);
+ executor.execute(new Task());
+ }
+
+ executor.shutdown();
+ executor.awaitTermination(1, TimeUnit.HOURS);
+
+ logger.log(Level.INFO, "Shutdown server");
+ logger.log(Level.INFO, "# service runs " + nbCurrent.get());
+ }
+
+ /**
+ * {@link Runnable} task launched by the server that will be in charge to call {@link ServerTask}
+ * implementation that will launch a Jack compilation either in the same VM, either in a spawn VM.
+ */
+ public static class Task implements Runnable {
+ @Override
+ public void run() {
+ while (true) {
+ String line;
+
+ try {
+ line = getLine();
+ logger.log(Level.FINE, "Read command '" + line + "'");
+ } catch (IOException e) {
+ logger.log(Level.FINE, "Shutdown task");
+ return;
+ }
+
+ String[] command = line.split(" ");
+
+ if (command[CMD_IDX_CMD].equals("=")) {
+ continue;
+ }
+
+ if (command[CMD_IDX_CMD].equals("-")) {
+ cancelTimer();
+ shutdownFifo();
+ continue;
+ }
+
+ if (!command[CMD_IDX_CMD].equals("+")) {
+ logger.log(Level.SEVERE, "Command error '" + line + "'");
+ continue;
+ }
+
+ PrintStream out = null;
+ PrintStream err = null;
+ PrintStream exit = null;
+
+ try {
+ if (command.length != CMD_IDX_END) {
+ logger.log(Level.SEVERE, "Command format error '" + line + "'");
+ continue;
+ }
+
+ logger.log(Level.FINE, "Open standard output '" + command[CMD_IDX_OUT] + "'");
+ try {
+ out = new OutputStreamFile(command[CMD_IDX_OUT]).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ continue;
+ }
+
+ logger.log(Level.FINE, "Open standard error '" + command[CMD_IDX_ERR] + "'");
+ try {
+ err = new OutputStreamFile(command[CMD_IDX_ERR]).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ continue;
+ }
+
+ logger.log(Level.FINE, "Open exit fifo '" + command[CMD_IDX_EXIT] + "'");
+ try {
+ exit = new OutputStreamFile(command[CMD_IDX_EXIT]).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ continue;
+ }
+
+ logger.log(Level.FINE, "Parse command line");
+ TokenIterator args = new TokenIterator(new NoLocation(), "@" + command[CMD_IDX_CLI]);
+ args.allowFileReferenceInFile();
+ if (!args.hasNext()) {
+ logger.log(Level.SEVERE, "Cli format error");
+ continue;
+ }
+
+ String workingDir;
+ try {
+ workingDir = args.next();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Cli format error");
+ continue;
+ }
+
+ if (nbMax.getAndIncrement() == 0) {
+ cancelTimer();
+ }
+
+ int code = -1;
+ try {
+ logger.log(Level.FINE, "Run service");
+ nbCurrent.incrementAndGet();
+ code = service.run(out, err, new File(workingDir), args);
+ } finally {
+ if (nbMax.decrementAndGet() == 0) {
+ startTimer();
+ }
+
+ logger.log(Level.FINE, "Write exit code '" + code + "'");
+ assert exit != null;
+ exit.println(code);
+ }
+ } finally {
+ if (out != null) {
+ out.close();
+ } else {
+ unblock(command[CMD_IDX_OUT]);
+ }
+
+ if (err != null) {
+ err.close();
+ } else {
+ unblock(command[CMD_IDX_ERR]);
+ }
+
+ if (exit != null) {
+ exit.close();
+ } else {
+ unblock(command[CMD_IDX_EXIT]);
+ }
+ }
+ }
+ }
+ }
+
+ @Nonnull
+ private static Object lockRead = new Object();
+
+ private static volatile boolean stop = false;
+
+ @Nonnull
+ public static String getLine() throws IOException {
+ synchronized (lockRead) {
+ if (in == null) {
+ throw new IOException();
+ }
+
+ assert in != null;
+ String str = in.readLine();
+ while (str == null) {
+ try {
+ in.close();
+ } catch (IOException e1) {
+ // Best effort
+ }
+ in = null;
+
+ if (stop) {
+ throw new IOException();
+ }
+
+ in = new BufferedReader(new FileReader(fifo));
+ assert in != null;
+ str = in.readLine();
+ }
+
+ return str;
+ }
+ }
+
+ private static void startFifo() {
+ logger.log(Level.FINE, "Start FIFO");
+ }
+
+ private static void shutdownFifo() {
+ logger.log(Level.FINE, "Shutdown FIFO");
+
+ stop = true;
+
+ Unblocker unblocker = new Unblocker();
+ unblocker.setName("Unblocker");
+ unblocker.setDaemon(true);
+ unblocker.start();
+ }
+
+ private static class Unblocker extends Thread {
+ @Override
+ public void run() {
+ PrintStream out = null;
+
+ while (true) {
+ try {
+ out = new PrintStream(fifo);
+ } catch (FileNotFoundException e) {
+ // Best effort
+ }
+
+ if (out != null) {
+ out.close();
+ }
+
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // Best effort here
+ }
+ }
+ }
+ }
+
+ private static void abort() {
+ System.exit(1);
+ }
+
+ @CheckForNull
+ private static Timer timer;
+
+ @Nonnull
+ private static Object lockTimer = new Object();
+
+ private static void startTimer() {
+ synchronized (lockTimer) {
+ if (timer != null) {
+ cancelTimer();
+ }
+
+ logger.log(Level.FINE, "Start timer");
+
+ timer = new Timer("jack-server-timeout");
+ assert timer != null;
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ shutdownFifo();
+ cancelTimer();
+ }
+ }, timeout);
+ }
+ }
+
+ private static void cancelTimer() {
+ synchronized (lockTimer) {
+ if (timer != null) {
+ logger.log(Level.FINE, "Cancel timer");
+
+ timer.cancel();
+ timer.purge();
+ timer = null;
+ }
+ }
+ }
+
+ private static void unblock(@Nonnull String name) {
+ logger.log(Level.FINE, "Trying to unblock '" + name + "'");
+ PrintStream out = null;
+ try {
+ out = new OutputStreamFile(name).getPrintStream();
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, e.getMessage(), e);
+ }
+
+ if (out != null) {
+ out.close();
+ }
+ }
+}
diff --git a/jack-server/src/com/android/jack/server/ServerExitStatus.java b/jack-server/src/com/android/jack/server/ServerExitStatus.java
new file mode 100644
index 00000000..6f37ab28
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/ServerExitStatus.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.android.jack.ExitStatus;
+
+/**
+ * Server exit status.
+ */
+public class ServerExitStatus extends ExitStatus {
+ /**
+ * Jack jar not found.
+ */
+ public static final int FAILURE_JACK_JAR_NOT_FOUND = -1;
+
+}
diff --git a/jack-server/src/com/android/jack/server/ServerTask.java b/jack-server/src/com/android/jack/server/ServerTask.java
new file mode 100644
index 00000000..b89f76ca
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/ServerTask.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.android.sched.util.config.cli.TokenIterator;
+
+import java.io.File;
+import java.io.PrintStream;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Interface of tasks that will be launched by the Jack server.
+ */
+public interface ServerTask {
+ int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File workingDir,
+ @Nonnull TokenIterator args);
+} \ No newline at end of file
diff --git a/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java b/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java
new file mode 100644
index 00000000..7331c9ea
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.android.jack.CommandLine;
+import com.android.jack.Main;
+import com.android.jack.Options;
+import com.android.sched.util.config.cli.TokenIterator;
+import com.android.sched.util.file.CannotReadException;
+import com.android.sched.util.file.NoSuchFileException;
+import com.android.sched.util.file.NotDirectoryException;
+import com.android.sched.util.file.NotFileOrDirectoryException;
+import com.android.sched.util.file.WrongPermissionException;
+
+import org.kohsuke.args4j.CmdLineException;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import javax.annotation.Nonnull;
+
+/**
+ * {@link ServerTask} implementation that launches compilations with Jack into the running VM.
+ */
+public class ServerTaskInsideVm extends CommandLine implements ServerTask {
+
+ @Override
+ public int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File pwd,
+ @Nonnull TokenIterator args) {
+ List<String> list = new ArrayList<String>();
+ Options options;
+
+ try {
+ args.withFileRelativeTo(pwd);
+ } catch (NotDirectoryException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (WrongPermissionException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (NoSuchFileException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ }
+
+ try {
+ while (args.hasNext()) {
+ list.add(args.next());
+ }
+ options = Main.parseCommandLine(list);
+ options.setWorkingDirectory(pwd);
+ options.setStandardError(err);
+ options.setStandardOutput(out);
+ } catch (CmdLineException e) {
+ if (e.getMessage() != null) {
+ err.println(e.getMessage());
+ }
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (NoSuchElementException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (WrongPermissionException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (NoSuchFileException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (NotFileOrDirectoryException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ } catch (CannotReadException e) {
+ err.println(e.getMessage());
+ return ServerExitStatus.FAILURE_USAGE;
+ }
+
+ return runJack(err, options);
+ }
+}
diff --git a/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java b/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java
new file mode 100644
index 00000000..a8ef6aba
--- /dev/null
+++ b/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.jack.server;
+
+import com.android.jack.util.ExecuteFile;
+import com.android.sched.util.config.cli.TokenIterator;
+import com.android.sched.util.file.CannotReadException;
+import com.android.sched.util.file.InputStreamFile;
+import com.android.sched.util.file.NoSuchFileException;
+import com.android.sched.util.file.NotFileOrDirectoryException;
+import com.android.sched.util.file.WrongPermissionException;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.Nonnull;
+
+/**
+ * {@link ServerTask} implementation that launches compilations with Jack into a spawned VM.
+ */
+public class ServerTaskSpawningVM implements ServerTask {
+
+ private static class MissingEnvException extends Exception {
+ private static final long serialVersionUID = 1L;
+ @Nonnull
+ private final String missingVariable;
+
+ public MissingEnvException(@Nonnull String missingVariable) {
+ this.missingVariable = missingVariable;
+ }
+
+ @Nonnull
+ @Override
+ public String getMessage() {
+ return "Environment variable '" + missingVariable + "' is undefined";
+ }
+ }
+ @Nonnull
+ private static Logger logger = Logger.getLogger(ServerTaskSpawningVM.class.getSimpleName());
+
+ @Override
+ public int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File pwd,
+ @Nonnull TokenIterator args) {
+ List<String> commandLineArgs;
+ try {
+ commandLineArgs = buildArgs(args);
+ } catch (NoSuchFileException e) {
+ return ServerExitStatus.FAILURE_JACK_JAR_NOT_FOUND;
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Failed to build command line", e);
+ return ServerExitStatus.FAILURE_USAGE;
+ }
+
+ ExecuteFile exec = new ExecuteFile(commandLineArgs.toArray(new String[commandLineArgs.size()]));
+ exec.setErr(err);
+ exec.setOut(out);
+
+ try {
+ exec.setWorkingDir(pwd, /* create */false);
+ } catch (IOException e) {
+ // It means that pwd is not a directory
+ return ServerExitStatus.FAILURE_USAGE;
+ }
+
+ try {
+ return exec.run();
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "Failed to run command " + commandLineArgs, e);
+
+ return ServerExitStatus.FAILURE_UNKNOWN;
+ }
+ }
+
+ @Nonnull
+ private List<String> buildArgs(@Nonnull TokenIterator args)
+ throws NoSuchElementException,
+ WrongPermissionException,
+ NoSuchFileException,
+ NotFileOrDirectoryException,
+ CannotReadException, MissingEnvException {
+
+ List<String> commandLineArgs = new ArrayList<String>();
+ String vmCommand = System.getenv("JACK_VM_COMMAND");
+ if (vmCommand == null) {
+ throw new MissingEnvException("JACK_VM_COMMAND");
+ }
+ String jackJarPath = System.getenv("JACK_JAR");
+ if (jackJarPath == null) {
+ throw new MissingEnvException("JACK_JAR");
+ }
+ new InputStreamFile(jackJarPath);
+
+ StreamTokenizer iter = getCommandLineTokenizer(vmCommand);
+ try {
+ while (iter.nextToken() != StreamTokenizer.TT_EOF) {
+ commandLineArgs.add(iter.sval);
+ }
+ } catch (IOException e) {
+ throw new AssertionError();
+ }
+ commandLineArgs.add("-jar");
+ commandLineArgs.add(jackJarPath);
+
+ while (args.hasNext()) {
+ commandLineArgs.add(args.next());
+ }
+
+ return commandLineArgs;
+ }
+
+ @Nonnull
+ private static StreamTokenizer getCommandLineTokenizer(@Nonnull String command) {
+ StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(command));
+
+ tokenizer.resetSyntax();
+ tokenizer.wordChars(0, 255);
+ tokenizer.whitespaceChars(' ', ' ');
+ tokenizer.whitespaceChars('\t', '\t');
+ tokenizer.whitespaceChars('\n', '\n');
+ tokenizer.whitespaceChars('\r', '\r');
+ tokenizer.quoteChar('\'');
+ tokenizer.quoteChar('\"');
+ tokenizer.eolIsSignificant(false);
+ tokenizer.slashSlashComments(false);
+ tokenizer.slashStarComments(false);
+ tokenizer.lowerCaseMode(false);
+
+ return tokenizer;
+ }
+}