Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRocks committed Apr 17, 2018
2 parents c41343b + 011bb51 commit d7869d3
Show file tree
Hide file tree
Showing 26 changed files with 352 additions and 258 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android:
- tools
- tools
- platform-tools
- build-tools-27.0.0
- build-tools-27.0.3
- android-27

jdk:
Expand All @@ -23,6 +23,9 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

before_install:
- yes | sdkmanager "platforms;android-27"

install:
- ./gradlew assemble publishToMavenLocal -Pbootstrap=true --no-daemon --rerun-tasks

Expand Down
48 changes: 20 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,38 @@
allprojects {
ext.kotlinVersion = '1.2.21'
ext.kotlinVersion = '1.2.31'
ext.pabloVersion = '1.0.0'

ext.asmVersion = '6.0'
ext.gripVersion = '0.6.0-beta'
ext.logbackVersion = '1.2.3'

ext.junitVersion = '4.12'

ext.androidToolsVersion = '3.1.1'
ext.supportVersion = '27.1.0'

ext.runnerVersion = '1.0.1'
ext.espressoVersion = '3.0.1'

buildscript {
repositories {
mavenLocal()
google()
jcenter()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "io.michaelrocks.pablo:pablo:$pabloVersion"
}
}

repositories {
mavenLocal()
google()
jcenter()
}
}

allprojects {
def properties = new Properties()
properties.load(new FileInputStream(new File(rootDir, "version.properties")))
def major = properties['version.major'] as int
def minor = properties['version.minor'] as int
def patch = properties['version.patch'] as int
def suffix = properties['version.suffix']?.toString()?.trim() ?: ""
def snapshot = properties['version.snapshot'].toBoolean()
version = "$major.$minor.$patch" + (suffix.isAllWhitespace() ? '' : "-$suffix") + (snapshot ? '-SNAPSHOT' : '')
group = 'io.michaelrocks'

ext.dryRun = properties['version.dryRun'].toBoolean()
ext.publish = properties['version.publish'].toBoolean()
}

ext {
asmVersion = '5.2'
gripVersion = '0.5.3-beta'
logbackVersion = '1.2.3'

junitVersion = '4.12'

androidToolsVersion = '3.0.1'
supportVersion = '27.0.2'

runnerVersion = '1.0.1'
espressoVersion = '3.0.1'
version = '0.2.0'
}
7 changes: 0 additions & 7 deletions buildSrc/build.gradle

This file was deleted.

111 changes: 0 additions & 111 deletions buildSrc/src/main/groovy/io/michaelrocks/bintray/BintrayPlugin.groovy

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'java'
apply plugin: 'bintray'
apply plugin: 'io.michaelrocks.pablo'

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/michaelrocks/paranoid/Obfuscate.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016 Michael Rozumyanskiy
* Copyright 2018 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Retention(RetentionPolicy.CLASS)
@Documented
public @interface Obfuscate {
}
32 changes: 16 additions & 16 deletions gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

apply plugin: 'kotlin'
apply plugin: 'bintray'
apply plugin: 'io.michaelrocks.pablo'
apply plugin: 'idea'

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_6

dependencies {
compile gradleApi()
compile project(':processor')

compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlinVersion"

compileOnly gradleApi()
compileOnly "com.android.tools.build:gradle:$androidToolsVersion"
compileOnly "com.android.tools.build:gradle-api:$androidToolsVersion"
}

relocate project(':processor')

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}

def generatedDir = new File(projectDir, "generated")
def generatedJavaSourcesDir = new File(generatedDir, "main/java")
Expand All @@ -43,7 +36,6 @@ task generateBuildClass {

sourceSets {
main {
output.dir(builtBy: tasks.generateBuildClass, generatedJavaSourcesDir)
java.srcDirs += generatedJavaSourcesDir
}
}
Expand All @@ -61,3 +53,11 @@ idea {
generatedSourceDirs += generatedJavaSourcesDir
}
}

shadowJar {
relocate 'io.michaelrocks.paranoid', 'io.michaelrocks.paranoid'
}

pablo {
repackage true
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
23 changes: 11 additions & 12 deletions processor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'bintray'
apply plugin: 'io.michaelrocks.pablo'

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

dependencies {
compile project(':core')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

compile "org.ow2.asm:asm:$asmVersion"
compile "org.ow2.asm:asm-commons:$asmVersion"
compile "io.michaelrocks:grip:$gripVersion"
compile "ch.qos.logback:logback-classic:$logbackVersion"

relocate "org.ow2.asm:asm:$asmVersion"
relocate "org.ow2.asm:asm-commons:$asmVersion"
relocate "io.michaelrocks:grip:$gripVersion"

testCompile "junit:junit:$junitVersion"
}

jar {
destinationDir = file('build/jar')
}

shadowJar {
relocate 'io.michaelrocks.paranoid', 'io.michaelrocks.paranoid'
relocate 'io.michaelrocks.grip', 'io.michaelrocks.paranoid.grip'
relocate 'org.objectweb.asm', 'io.michaelrocks.paranoid.asm'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Michael Rozumyanskiy
* Copyright 2018 Michael Rozumyanskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,17 +18,14 @@ package io.michaelrocks.paranoid.processor

import io.michaelrocks.grip.Grip
import io.michaelrocks.grip.and
import io.michaelrocks.grip.annotatedWith
import io.michaelrocks.grip.classes
import io.michaelrocks.grip.fields
import io.michaelrocks.grip.from
import io.michaelrocks.grip.isFinal
import io.michaelrocks.grip.isStatic
import io.michaelrocks.grip.mirrors.FieldMirror
import io.michaelrocks.grip.mirrors.Type
import io.michaelrocks.grip.mirrors.getType
import io.michaelrocks.grip.withFieldInitializer
import io.michaelrocks.paranoid.Obfuscate
import java.io.File

class Analyzer(private val grip: Grip) {
Expand All @@ -42,7 +39,8 @@ class Analyzer(private val grip: Grip) {
}

private fun findTypesToObfuscate(inputs: List<File>): Set<Type.Object> {
val query = grip select classes from inputs where annotatedWith(OBFUSCATE_TYPE)
val registry = newObfuscatedTypeRegistry(grip.classRegistry).withCache()
val query = grip select classes from inputs where registry.shouldObfuscate()
return query.execute().types.toHashSet()
}

Expand All @@ -60,8 +58,4 @@ class Analyzer(private val grip: Grip) {
val query = grip select fields from mirror where (isStatic() and isFinal() and withFieldInitializer<String>())
return query.execute()[type].orEmpty()
}

companion object {
private val OBFUSCATE_TYPE = getType<Obfuscate>()
}
}
Loading

0 comments on commit d7869d3

Please sign in to comment.