Skip to content

Commit

Permalink
Merge pull request #42 from pakerwreah/develop
Browse files Browse the repository at this point in the history
v1.5.2
  • Loading branch information
pakerwreah authored May 18, 2021
2 parents a06ffde + 7b01e49 commit 1db7c13
Show file tree
Hide file tree
Showing 84 changed files with 14,241 additions and 311 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

env:
NDK_VERSION: 21.0.6113669
NDK_VERSION: 21.1.6352462

steps:
- name: Checkout
Expand All @@ -24,23 +24,15 @@ jobs:

- name: Create NDK folder
run: |
sudo mkdir ${ANDROID_HOME}/ndk
sudo mkdir -p ${ANDROID_HOME}/ndk
sudo chmod -R a+rwx ${ANDROID_HOME}/ndk
sudo chown -R $USER:$USER ${ANDROID_HOME}/ndk
- name: Export environments
run: |
echo "::set-env name=ANDROID_HOME::$ANDROID_HOME"
- name: NDK Cache
id: ndk-cache
uses: actions/cache@v2
with:
path: ${{env.ANDROID_HOME}}/ndk
key: ndk-cache-${{env.NDK_VERSION}}
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
- name: Install NDK
if: steps.ndk-cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;${NDK_VERSION}" | grep -v = || true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

steps:
- name: Checkout
Expand All @@ -17,7 +17,7 @@ jobs:
- name: Install Linux dependencies
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main' | sudo tee -a /etc/apt/sources.list.d/llvm.list
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal main' | sudo tee -a /etc/apt/sources.list.d/llvm.list
sudo add-apt-repository ppa:linuxgndu/sqlcipher -y
sudo apt-get update -y
Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Inspector
![release](https://img.shields.io/github/v/release/pakerwreah/Inspector)
[![release](https://img.shields.io/github/v/release/pakerwreah/Inspector)](https://github.com/pakerwreah/Inspector/releases/latest)
![c++](https://img.shields.io/badge/C++-17-blue.svg?style=flat&logo=c%2B%2B)
![android](https://img.shields.io/badge/Android-grey.svg?style=flat&logo=android)
![ios](https://img.shields.io/badge/iOS-grey.svg?style=flat&logo=apple)
Expand All @@ -18,23 +18,31 @@ To keep network log history the web system uses the built-in IndexedDB from the
https://github.com/pakerwreah/InspectorWeb

## Android
[![Version](https://api.bintray.com/packages/pakerwreah/Inspector/br.newm.inspector/images/download.svg)](https://bintray.com/pakerwreah/Inspector/br.newm.inspector/_latestVersion)
[![Version](https://jitpack.io/v/pakerwreah/Inspector.svg)](https://jitpack.io/#pakerwreah/Inspector)

<details>
<summary>Setup</summary>

#### Gradle
```gradle
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
```
```gradle
dependencies {
implementation "br.newm.inspector:inspector:<version>"
implementation "com.github.pakerwreah:Inspector:<release-tag>"
}
```

#### Proguard
```
-keep class br.newm.inspector.* { *; }
```
</details>

<details>
<summary>Usage</summary>

#### Application
```java
Expand Down Expand Up @@ -128,15 +136,24 @@ Inspector.sendMessage("mykey", "Hello world!");
adb forward tcp:30000 tcp:30000
```
Or configure its network as bridge and use the device's IP
</details>

## iOS
[![Version](https://img.shields.io/cocoapods/v/IOSInspector.svg)](https://cocoapods.org/pods/IOSInspector)

<details>
<summary>Setup</summary>

#### CocoaPods
```gradle
target 'MyApp' do
pod "IOSInspector"
end
```
</details>

<details>
<summary>Usage</summary>

#### AppDelegate
```swift
Expand Down Expand Up @@ -227,3 +244,4 @@ new WebSocket(`ws://${location.hostname}:${location.port}/plugins/ws/mykey`)
```swift
IOSInspector.sendMessage(to: "mykey", message: "Hello world!")
```
</details>
3 changes: 2 additions & 1 deletion android/app/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies {
localImplementation project(':inspector')
localImplementation 'com.squareup.okhttp3:okhttp:4.4.0'

mavenImplementation 'br.newm.inspector:inspector:1.5.1'
// gradle resolves all flavors every time, so we have to comment this out
// mavenImplementation 'com.github.pakerwreah:Inspector:develop-SNAPSHOT'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
Expand Down
9 changes: 4 additions & 5 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()

mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.android.tools.build:gradle:4.2.1'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

Expand Down
2 changes: 1 addition & 1 deletion android/app/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
7 changes: 3 additions & 4 deletions android/lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()

}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'com.android.tools.build:gradle:4.2.1'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
4 changes: 0 additions & 4 deletions android/lib/deploy.sh

This file was deleted.

6 changes: 3 additions & 3 deletions android/lib/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Oct 16 20:47:40 BRT 2020
#Mon May 17 20:09:34 BRT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion android/lib/inspector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 30
ndkVersion '21.0.6113669'
ndkVersion '21.1.6352462'
buildToolsVersion "30.0.2"
defaultConfig {
minSdkVersion 14
Expand Down
46 changes: 2 additions & 44 deletions android/lib/inspector/publish.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

version '1.5.1'
version '1.5.2'
group 'br.newm.inspector'

def getProperties(filename) {
try {
Properties properties = new Properties()
properties.load(project.rootProject.file(filename).newDataInputStream())
return properties
} catch (Exception ex) {
logger.log(LogLevel.ERROR, ex.message)
}
}

publishing {
publications {
Production(MavenPublication) {
release(MavenPublication) {
artifact("$buildDir/outputs/aar/inspector-release.aar")
groupId this.group
artifactId 'inspector'
Expand All @@ -36,34 +25,3 @@ publishing {
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

artifacts {
archives sourcesJar
}

bintray {
def props = getProperties('bintray.properties')
if (props) {
user = props.getProperty("user")
key = props.getProperty("key")
}
publications = ['Production']
configurations = ['archives']
dryRun = false
publish = true
override = true
pkg {
repo = 'Inspector'
name = this.group
version {
name = this.version
vcsTag = "v${this.version}"
released = new Date()
}
}
}
1 change: 1 addition & 0 deletions android/lib/inspector/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.10.2)
project(Inspector)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
7 changes: 5 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.13.0)
project(Inspector)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -7,14 +8,16 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)

project(inspector)
add_custom_target(cpplint python3 tools/cpplint/cpplint.py --quiet --recursive src WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

include_directories(src src/utils src/libs)

file(GLOB_RECURSE sources src/*.cpp src/*.c)

# Create base object with sources
add_library(inspector-cpp OBJECT ${sources})
target_compile_options(inspector-cpp PRIVATE -pedantic-errors -Werror -Wall -Wextra -Wno-reorder-ctor -Wno-sign-compare)
add_dependencies(inspector-cpp cpplint)

# Configure code coverage
include(CodeCoverage.cmake)
Expand All @@ -34,6 +37,6 @@ target_link_libraries(inspector-demo inspector-cpp)
# Create tests runner
file(GLOB_RECURSE tests tests/*.cpp)
add_executable(inspector-tests ${tests})
target_include_directories(inspector-tests PRIVATE tests/utils)
target_include_directories(inspector-tests PRIVATE tests/libs tests/utils)
target_link_libraries(inspector-tests inspector-cpp)
add_custom_target(test inspector-tests)
40 changes: 40 additions & 0 deletions cpp/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
##
# `filematch` is a custom directive added to cpplint.py
# so we can have rules for files that match a specific pattern
##
set noparent

linelength=130
filter=-legal/copyright

# `build` rules
filter=-build/c++11
filter=-build/include_what_you_use
filter=-build/header_guard
filter=-build/include_subdir

# `whitespace` rules
filter=-whitespace/indent
filter=-whitespace/comments
filter=-whitespace/blank_line

# `readability` rules
filter=-readability/namespace
filter=-readability/todo
filter=-readability/check

# `runtime` rules
filter=-runtime/references
filter=-runtime/indentation_namespace
filter=-runtime/int

# `cpp` rules
filematch=*.cpp
filter=-build/namespaces

# these files tend to have a lot of C-style code
filematch=Socket.cpp
filter=-readability/casting

filematch=UDPSocket.cpp
filter=-readability/casting
14 changes: 13 additions & 1 deletion cpp/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
#!/bin/sh
cmake -Bcmake-build-debug && make -C cmake-build-debug

GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'

if [ -f /.dockerenv ]; then
printf "\n💡 ${GREEN}Building outside volume for better performance: ${CYAN}../cmake-build-debug${NC}\n\n"
cmake -B../cmake-build-debug && make -C ../cmake-build-debug -j
cp clear-gcda.sh ../cmake-build-debug
else
cmake -Bcmake-build-debug && make -C cmake-build-debug -j
cp clear-gcda.sh cmake-build-debug
fi
2 changes: 1 addition & 1 deletion cpp/ext/explorer/explorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <filesystem>

using namespace std;
using json = nlohmann::json;
using nlohmann::json;

Explorer::Explorer(Inspector &inspector, const string &root) {

Expand Down
7 changes: 2 additions & 5 deletions cpp/ext/explorer/explorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
// Created by Paker on 17/08/20.
//

#ifndef INSPECTOR_EXPLORER_H
#define INSPECTOR_EXPLORER_H
#pragma once

#include "Inspector.h"

struct Explorer {
Explorer(Inspector &inspector, const std::string &root = ".");
explicit Explorer(Inspector &inspector, const std::string &root = ".");
};

#endif //INSPECTOR_EXPLORER_H
Loading

0 comments on commit 1db7c13

Please sign in to comment.